Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #1174 by preventing non-schema JSON node types (notably TextNode) from being treated as valid JSON Schemas, which previously could result in “accept anything” behavior due to empty validator sets.
Changes:
- Add validation in
SchemaRegistryto reject schema root nodes that are neither an object nor (where supported) a boolean. - Add regression tests covering
TextNoderoot schemas and boolean-schema support differences between Draft 4 and Draft 7.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/test/java/com/networknt/schema/Issue1174Test.java | Adds regression tests for rejecting TextNode schemas and for boolean-schema behavior across drafts. |
| src/main/java/com/networknt/schema/SchemaRegistry.java | Adds schema node null/type validation and draft-aware boolean-schema acceptance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Viewed spec.yaml:39-84 This is an excellent pull request for specification compliance and strictness. Here is my review of the changes in PR #1250: 1. Strict Schema Node Type ValidationThe most significant change is the introduction of strict type validation for schema nodes ( This strictness is so effective that it actually caught several malformed schemas in your own test suite! For example:
2. Specification-Aware Boolean SchemasThe PR correctly implements boolean schema support based on the JSON Schema draft version. By introducing 3. Graceful Fragment ResolutionThe overloaded ConclusionThis PR massively improves the robustness of the validator. It prevents users from writing silent bugs in their JSON schemas (like typing Everything looks great and ready to merge! |
* fixes #1248 validating draft4 schemas (#1249) * fixes #1248 validating draft4 schemas * Address regex factory review comments * Rename regex specification version variable * fixes #1174 TextNodes as schema seem to validate any value (#1250) * fixes #1174 TextNodes as schema seem to validate any value * Address loaded schema validation for issue 1174 * Address schema node validation review comments * Preserve mapped schema override path * Validate referenced document fragment schemas * Remove duplicate schema type validation * Validate loaded schemas for anchor refs * fixes #1252 problem with additionalProperties schema in jsconfig schema (#1253) * Add method to SpecificationVersion to determine from schema node (#1221) * Manual adjustments for Jackson 2 compatibility and CVE fix --------- Co-authored-by: Justin Tay <[email protected]>
No description provided.