You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement JSON Type Definition (JTD) RFC 8927 validator with full compliance (Closes#85) (#87)
This PR #87 deletes the json-java21-schema module and adds a complete implementation of JSON Type Definition (JTD) RFC 8927 validator as requested in issue #85. Here's what was accomplished:
🎯 What Was Actually Built (Issue #85)
Complete JTD RFC 8927 validator, replacing the deleted JSON Schema module
All 8 schema forms implemented: Empty, Ref, Type, Enum, Elements, Properties, Values, Discriminator
423 tests passing: 58 unit + 365 official JTD Test Suite integration tests
Full RFC compliance: Leap seconds, strict properties, ref resolution, discriminator exemption
Production-ready architecture: Stack-based validation, immutable records, lazy resolution
📊 Scope of Work
15 commits of intensive development
89 files changed: 4,527 insertions, 10,135 deletions
Complete module transformation: json-java21-schema → json-java21-jtd
Comprehensive documentation: README.md, ARCHITECTURE.md, API docs
-`json-java21-jtd`: JSON Type Definition (JTD) validator based on RFC 8927.
107
107
108
108
### Core Components
109
109
@@ -176,16 +176,11 @@ IMPORTANT: Bugs in the main logic this code cannot be fixed in this repo they **
176
176
- Workflow fetches upstream sources, parses both codebases with the Java compiler API, and reports matching/different/missing elements across modifiers, inheritance, methods, fields, and constructors.
177
177
- Continuous integration prints the report daily. It does not fail or open issues on differences; to trigger notifications, either make the runner exit non-zero when `differentApi > 0` or parse the report and call `core.setFailed()` within CI.
178
178
179
-
### json-java21-schema (JSON Schema Validator)
180
-
- Inherits all repository-wide logging and testing rules described above.
181
-
- You MUST place an INFO-level JUL log statement at the top of every test method declaring execution.
182
-
- All new tests MUST extend a configuration helper such as `JsonSchemaLoggingConfig` to ensure JUL levels respected.
183
-
- WARNING: you cannot run `mvn -pl xxxx verify` at the top level it will not work.
184
-
- You must run `cd -Djson.schema.strict=true -Djson.schema.metrics=csv -Djava.util.logging.ConsoleHandler.level=INFO`
185
-
186
-
#### Running Tests (Schema Module)
187
-
- All prohibitions on output filtering apply. Do not pipe logs unless you must constrain an infinite stream, and even then examine a large sample (thousands of lines).
188
-
- Remote location of `$(command -v mvnd || command -v mvn || command -v ./mvnw)` is the repository root; pass module selectors through it for schema-only runs.
179
+
### json-java21-jtd (JTD Validator)
180
+
- JSON Type Definition validator implementing RFC 8927 specification.
181
+
- Provides eight mutually-exclusive schema forms for simple, predictable validation.
182
+
- Uses stack-based validation with comprehensive error reporting.
183
+
- Includes full RFC 8927 compliance test suite.
189
184
190
185
## Security Notes
191
186
- Deep nesting can trigger StackOverflowError (stack exhaustion attacks).
Copy file name to clipboardExpand all lines: README.md
+39-23Lines changed: 39 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@ References:
9
9
This project is not an official release; APIs and behaviour may change as upstream evolves.
10
10
You can find this code on [Maven Central](https://central.sonatype.com/artifact/io.github.simbo1905.json/java.util.json).
11
11
12
-
To kick the tyres on the New JSON API this repo uses to implement a JSON Schema Validator which is released on Maven Central as [java.util.json.schema](https://central.sonatype.com/artifact/io.github.simbo1905.json/java.util.json.schema).
12
+
To kick the tyres on the New JSON API this repo includes a JSON Type Definition (JTD) Validator implementing RFC 8927, released on Maven Central as part of this project.
13
13
14
-
We welcome contributes to the JSON Schema Validator incubating within this repo.
14
+
We welcome contributions to the JTD Validator incubating within this repo.
15
15
16
16
## Usage Examples
17
17
@@ -289,38 +289,54 @@ This is a simplified backport with the following changes from the original:
289
289
290
290
Such vulnerabilities existed at one point in the upstream OpenJDK sandbox implementation and were reported here for transparency. Until the upstream code is stable it is probably better to assume that such issue or similar may be present or may reappear. If you are only going to use this library in small cli programs where the json is configuration you write then you will not parse objects nested to tens of thousands of levels designed crash a parser. Yet you should not at this tiome expose this parser to the internet where someone can choose to attack it in that manner.
291
291
292
-
## JSON Schema Validator
292
+
## JSON Type Definition (JTD) Validator
293
293
294
-
This repo contains an incubating schema validator that has the core JSON API as its only depenency. This subproject demonstrates how to build realistic JSON heavy logic using the API. It follows Data Oriented Programming principles: it compiles the JSON Schema into an immutable structure of records. For validation it parses the JSON document to the generic structure and uses the thread-safe parsed schema and a stack to visit and validate the parsed JSON.
294
+
This repo contains an incubating JTD validator that has the core JSON API as its only dependency. This sub-project demonstrates how to build realistic JSON heavy logic using the API. It follows Data Oriented Programming principles: it compiles JTD schemas into an immutable structure of records. For validation it parses the JSON document to the generic structure and uses the thread-safe parsed schema and a stack to visit and validate the parsed JSON.
295
295
296
-
A simple JSON Schema validator is included (module: json-java21-schema).
296
+
A complete JSON Type Definition validator is included (module: json-java21-jtd).
297
297
298
298
```java
299
-
var schema =io.github.simbo1905.json.schema.JsonSchema.compile(
0 commit comments