Skip to content

feat(core): full JSON Schema validation for values.schema.json via NetworkNT (#816) - #818

Open
alexmond wants to merge 1 commit into
mainfrom
feat/816-networknt-schema-validation
Open

feat(core): full JSON Schema validation for values.schema.json via NetworkNT (#816)#818
alexmond wants to merge 1 commit into
mainfrom
feat/816-networknt-schema-validation

Conversation

@alexmond

Copy link
Copy Markdown
Owner

Closes #816.

What

Replaces the hand-rolled SchemaValidator (a ~10-keyword partial Draft-07 subset) with the full-spec com.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 whose values.schema.json used any of these passed jhelm but behaved differently under real Helm:

Library Draft
Helm 3 xeipuuv/gojsonschema Draft-07 (full spec)
Helm 4 (main) santhosh-tekuri/jsonschema v6 draft 2020-12 (full spec)
jhelm (before) hand-rolled ~10 keywords

How

  • Default dialect draft 2020-12 (Helm 4's default); a schema declaring its own $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.
  • Public contract unchangedvalidate(chartName, schemaJson, values) still throws SchemaValidationException; Engine, LintAction, and the autoconfig bean are untouched.
  • Compiled schemas cached by content (the old code re-parsed on every call); malformed-schema-treated-as-absent preserved; NetworkNT OutputUnit mapped to the existing List<String> error shape.
  • Helm float64 semantics locked by test — a whole-valued double (8080.0) satisfies type: integer, a fractional one (80.5) fails.

Tests

SchemaValidatorTest expanded 12 → 27: the original cases plus additionalProperties: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 -amBUILD 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

…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-lab

unitrack-lab Bot commented Aug 13, 2026

Copy link
Copy Markdown

UniTrack — ✅ gate passed

Metric Value
Tests 1869 passed · 0 failed · 1 skipped (1870 total)
Coverage 80.2% (+0.1pp vs base)
Quality gate PASSED
Slower tests 25

View run →

@github-actions

Copy link
Copy Markdown
Contributor
Overall Project 79.41% -0.05% 🍏
Files changed 86.81% 🍏

Module Coverage
jhelm-core 87.98% -0.11% 🍏
Files
Module File Coverage
jhelm-core SchemaValidator.java 86.19% -11.43% 🍏

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.80952% with 11 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...g/alexmond/jhelm/core/service/SchemaValidator.java 73.80% 5 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full JSON Schema validation for values.schema.json (replace hand-rolled validator with NetworkNT)

1 participant