Skip to content

Commit

Permalink
add comment explaining AdditionalProperties logic
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed Oct 7, 2024
1 parent ec5e984 commit 882069d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions schema/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ func Render(document *parser.Document) (string, error) {
}

newSchema.SchemaProps.Properties = properties
// For objects that we know the properties of, we disallow additional properties. Only when the
// object is part of the "global" section do we allow additional properties. This is because this
// "global" section is a special Helm section that is shared between all charts and subcharts and
// thus might contain properties relevant only to other charts.
// See https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#global-chart-values for more information.
if len(level.Children) > 0 && !(paths.Path{}).WithProperty("global").IsSubPathOf(level.Path) {
newSchema.SchemaProps.AdditionalProperties = &spec.SchemaOrBool{Allows: false}
}
Expand Down

0 comments on commit 882069d

Please sign in to comment.