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
Copy file name to clipboardExpand all lines: AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,6 +152,7 @@ See `README.md` for user-facing commands. When running locally as an agent, use
152
152
-`json-compatibility-suite`: JSON Test Suite compatibility validation.
153
153
-`json-java21-jtd`: JSON Type Definition (JTD) validator based on RFC 8927.
154
154
-`json-java21-jsonpath`: JsonPath query engine over `jdk.incubator.java.util.json` values.
155
+
-`jtd-esm-codegen`: Experimental JTD (RFC 8927) to ES2020 ESM validator code generator for JS consumers; 316/316 official validation.json conformance. See its README and `JTD_CODEGEN_SPEC.md` before working on it.
155
156
156
157
Only when you are asked to work on a specific module, start by reading that module's `README.md`, then its `AGENTS.md`.
We welcome contributions to the incubating modules.
41
42
@@ -413,6 +414,40 @@ An optional `jtd2jar` CLI tool and distroless Docker image are available for pre
413
414
414
415
See [`jtd2jar/README.md`](jtd2jar/README.md) for build instructions, container usage, and the pre-built image on GitHub Container Registry (`ghcr.io`).
415
416
417
+
## JTD to ESM Validator Codegen (Experimental)
418
+
419
+
This repo also contains an **experimental** CLI tool that reads a JTD schema (RFC 8927) and generates a **vanilla ES2020 module** exporting a `validate(instance)` function. The intended use case is validating JSON event payloads in the browser (for example, across tabs using `BroadcastChannel`) without a build step. The generator passes the full official JTD conformance suite (316/316 cases from `validation.json`) and its output is executed in GraalJS during the test run.
-`metadata.id` (used for the output filename prefix)
429
+
430
+
It rejects other JTD features (`elements`, `values`, `discriminator`/`mapping`, `ref`/`definitions`) and also rejects **nested `properties`** (object schemas inside properties).
431
+
432
+
When rejected, the error message is:
433
+
434
+
`Unsupported JTD feature: <feature>. This experimental tool only supports flat schemas with properties, optionalProperties, type, and enum.`
0 commit comments