mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix: handle dynamic schema paths in error message trimming
The error message trimming logic was hardcoded to remove the prefix "jsonschema validation failed with 'file:///values.schema.json#'", which broke when we switched to using absolute paths for $ref resolution. Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
This commit is contained in:
parent
a7884d228d
commit
6a2d9a8695
1 changed files with 6 additions and 1 deletions
|
|
@ -236,7 +236,12 @@ 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")
|
||||
// Remove the "jsonschema validation failed with 'file://...#'" line regardless of the path
|
||||
if strings.HasPrefix(errStr, "jsonschema validation failed with 'file://") {
|
||||
if idx := strings.Index(errStr, "#'\n"); idx != -1 {
|
||||
errStr = errStr[idx+3:] // Skip past "#'\n"
|
||||
}
|
||||
}
|
||||
|
||||
// The extra new line is needed for when there are sub-charts.
|
||||
return errStr + "\n"
|
||||
|
|
|
|||
Loading…
Reference in a new issue