feat: add values.schema.json for strict Helm values validation#95
Open
christhegrand wants to merge 3 commits intopgdogdev:mainfrom
Open
feat: add values.schema.json for strict Helm values validation#95christhegrand wants to merge 3 commits intopgdogdev:mainfrom
christhegrand wants to merge 3 commits intopgdogdev:mainfrom
Conversation
Adds a JSON Schema that validates all 157 top-level values properties with additionalProperties: false at every object level. This catches typos and misspelled field names at install/upgrade time instead of silently dropping them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Nice. How are you generating this? |
The schema is now generated by scripts/generate-schema.py which: - Scans all templates for .Values.* references - Infers types from template context (pgdog.intval → integer, toYaml → object, etc.) - Merges manually maintained overrides from scripts/schema-overrides.yaml (enums, descriptions, required fields, complex array item schemas) - Supports --check mode for CI to detect stale schemas Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
I added a 'generate schema' script together with an 'overrides' file for some other fields that the script was having trouble inferring properly. |
Contributor
|
Aight, let's try this! Thanks for writing it up. Edit: Woops, couple CI failures (the test job) |
Author
|
I'll fix the failures. |
queryParser was inferred as object due to `with .Values.queryParser` in the template — added explicit type: string override. otel.headers uses `range $k, $v` which doesn't match any object-detection pattern — added type: object override. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
values.schema.json(JSON Schema) that covers all 157 top-level values properties used across templatesadditionalProperties: falseat every object level so typos and misspelled field names are caught athelm install/helm upgradetime instead of being silently droppedlogLevel,logFormat,pullPolicy), and range validations where applicableMotivation
Without a schema, Helm silently ignores unknown values keys. A misspelled field name (e.g.
iamgeinstead ofimage) passes without error and the intended configuration is never applied.Validation
helm lint .passes with default valueshelm templaterenders successfully with default values andexamples/full-example.yamlTest plan
helm lint .passeshelm template test .renders successfullyhelm template test . -f examples/full-example.yamlrenders successfullyhelm template test . --set typoField=trueis rejected🤖 Generated with Claude Code