fix(schema): enable $ref resolution for directory charts

Set ChartDir only for directory-based charts to enable $ref resolution in
JSON schemas. Archived charts (.tgz) are loaded into memory without filesystem
extraction, so $ref resolution is not supported for them.

This fixes the original issue where `helm template .` and `helm install .`
failed to validate schemas with relative $ref references.

Fixes #31260

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
pull/31274/head
Benoit Tigeot 4 months ago
parent 088959aae9
commit 8b5d094f19
No known key found for this signature in database
GPG Key ID: 8E6D4FC8AEBDA62C

@ -84,6 +84,9 @@ func ValidateAgainstSchemaWithPath(ch chart.Charter, values map[string]any, char
return err
}
// Convert chartDir to absolute path for $ref resolution.
// If chartDir is empty (e.g., chart loaded from .tgz archive), absChartPath
// remains empty and a synthetic path will be used instead.
var absChartPath string
if chartDir != "" {
var err error

Loading…
Cancel
Save