mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Fix error message trimming for dynamic schema paths in JSON validation
Previously, the error trimming was hardcoded to remove only: 'jsonschema validation failed with 'file:///values.schema.json#'' After the fix for relative schema references (issue #31260), schema URLs now include the full absolute path, making error messages look like: 'jsonschema validation failed with 'file:///full/absolute/path/values.schema.json#'' Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
This commit is contained in:
parent
abf95de91e
commit
30d803283d
1 changed files with 5 additions and 1 deletions
|
|
@ -211,7 +211,11 @@ func (e JSONSchemaValidationError) Error() string {
|
|||
|
||||
// This string prefixes all of our error details. Further up the stack of helm error message
|
||||
// building more detail is provided to users. This is removed.
|
||||
errStr = strings.TrimPrefix(errStr, "jsonschema validation failed with 'file:///values.schema.json#'\n")
|
||||
if strings.HasPrefix(errStr, "jsonschema validation failed with ") {
|
||||
if idx := strings.Index(errStr, "#'\n"); idx != -1 {
|
||||
errStr = errStr[idx+3:]
|
||||
}
|
||||
}
|
||||
|
||||
// The extra new line is needed for when there are sub-charts.
|
||||
return errStr + "\n"
|
||||
|
|
|
|||
Loading…
Reference in a new issue