feat(core): full JSON Schema validation for values.schema.json via NetworkNT (#816) - #818
Open
alexmond wants to merge 1 commit into
Open
feat(core): full JSON Schema validation for values.schema.json via NetworkNT (#816)#818alexmond wants to merge 1 commit into
alexmond wants to merge 1 commit into
Conversation
…tworkNT (#816) Replace the hand-rolled ~10-keyword SchemaValidator with the full-spec com.networknt:json-schema-validator (v3 API), the same library the sister yj-schema-validator uses. This closes a Helm parity gap: the old validator silently ignored $ref/$defs, additionalProperties, items, oneOf/anyOf/allOf, if/then/else, const, patternProperties, exclusiveMinimum/Maximum, multipleOf, and format — so charts whose values.schema.json used any of them passed jhelm but behaved differently under real Helm. The validator now defaults to draft 2020-12 (Helm 4's default) and honours a schema's own $schema (e.g. the Draft-07 URI shipped by most existing charts, matching Helm 3). The public signature and SchemaValidationException are unchanged, so Engine, LintAction and the autoconfig bean are untouched. Compiled schemas are cached by content; malformed-schema-as-absent behaviour is preserved; Helm float64 semantics (a whole-valued double satisfies type:integer) are covered by tests. Tests expanded 12 -> 27: additionalProperties, $ref/$defs, oneOf/anyOf/allOf, if/then/else, items, const, exclusiveMinimum, multipleOf, the float64 integer parity pair, $schema-driven Draft-07 selection, and cache consistency. Follow-up #817 tracks exposing this via the REST API plus a schema-driven values UI editor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KqgktPVxm7fPW1tKvqqJcM
UniTrack — ✅ gate passed
|
Contributor
Files
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #816.
What
Replaces the hand-rolled
SchemaValidator(a ~10-keyword partial Draft-07 subset) with the full-speccom.networknt:json-schema-validator(v3 API) — the same library, at the same version, that the sister yj-schema-validator already uses on Jackson 3.Why
The old validator silently ignored most of the JSON Schema vocabulary —
$ref/$defs,additionalProperties,items,oneOf/anyOf/allOf,if/then/else,const,patternProperties,exclusiveMinimum/exclusiveMaximum,multipleOf,format. Charts whosevalues.schema.jsonused any of these passed jhelm but behaved differently under real Helm:xeipuuv/gojsonschemamain)santhosh-tekuri/jsonschemav6How
$schema(e.g. the Draft-07 URI most existing charts ship) validates against that draft — so both Helm 3 and Helm 4 charts are matched.validate(chartName, schemaJson, values)still throwsSchemaValidationException;Engine,LintAction, and the autoconfig bean are untouched.OutputUnitmapped to the existingList<String>error shape.8080.0) satisfiestype: integer, a fractional one (80.5) fails.Tests
SchemaValidatorTestexpanded 12 → 27: the original cases plusadditionalProperties:false,$ref/$defs,oneOf/anyOf/allOf,if/then/else,items,const,exclusiveMinimum,multipleOf, the float64-integer parity pair,$schema-driven Draft-07 selection, and compiled-schema cache consistency.Verification
mvn verify -pl jhelm-core -am— BUILD SUCCESS: 27/27 schema tests, all coverage gates met, 0 checkstyle, PMD clean.mvn -DskipTests install(full reactor) — all 17 modules compile and package with the new transitive dependency.Follow-up
#817 (depends on this) tracks your ask to expose schema validation via the REST API and build a schema-driven values UI editor on top of it.
🤖 Generated with Claude Code