-
Notifications
You must be signed in to change notification settings - Fork 0
Rename jdt2jar to jtd2jar #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,4 +18,4 @@ | |
| .env | ||
|
|
||
| # Local test artifacts | ||
| /tmp/jdt2jar-*/ | ||
| /tmp/jtd2jar-*/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| # jdt2jar | ||
| # jtd2jar | ||
|
|
||
| `jdt2jar` compiles a JTD schema into a standalone validator JAR at build time. The generated JAR runs on JDK 21+ with no JDK 25+ runtime dependency. | ||
| `jtd2jar` compiles a JTD schema into a standalone validator JAR at build time. The generated JAR runs on JDK 21+ with no JDK 25+ runtime dependency. | ||
|
|
||
| ## Use Case | ||
|
|
||
| This tool bridges the gap between the interpreter and codegen paths: | ||
|
|
||
| - **Interpreter** ([`json-java21-jtd`](../json-java21-jtd/README.md)): ideal for infrequent config parsing — simple, no build step, runs on JDK 21+. | ||
| - **Codegen** ([`json-java21-jtd-codegen`](../json-java21-jtd-codegen/README.md)): ideal for repeated hot-path validation — ~9x faster, but requires JDK 25+ at runtime. | ||
| - **jdt2jar**: pre-compiles schemas into validator JARs at build time (using JDK 25+), then deploys them to any JDK 21+ runtime. Best for CI/CD pipelines, distroless containers, or environments where you want JIT-optimised validators without shipping a JDK 25+ runtime. | ||
| - **jtd2jar**: pre-compiles schemas into validator JARs at build time (using JDK 25+), then deploys them to any JDK 21+ runtime. Best for CI/CD pipelines, distroless containers, or environments where you want JIT-optimised validators without shipping a JDK 25+ runtime. | ||
|
|
||
| > **Future note**: `java.util.json` has entered the JDK incubator (`jdk.incubator.json`). Once the API stabilises in the JDK itself, generated bytecode validators can depend directly on future JDK classes rather than this backport, making them even more efficient with zero library overhead. | ||
|
|
||
| ## CLI | ||
|
|
||
| ```bash | ||
| jdt2jar <schema.json> [options] | ||
| jtd2jar <schema.json> [options] | ||
| ``` | ||
|
|
||
| Options: | ||
|
|
@@ -35,24 +35,26 @@ A minimal distroless container image is available for offline schema compilation | |
| ### Pre-built Image (GitHub Container Registry) | ||
|
|
||
| ```bash | ||
| docker pull ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest | ||
| docker pull ghcr.io/simbo1905/java.util.json.java21/jdt2jar:2026.05.20 | ||
| docker pull ghcr.io/simbo1905/java.util.json.java21/jtd2jar:latest | ||
| docker pull ghcr.io/simbo1905/java.util.json.java21/jtd2jar:2026.05.20 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The documented AGENTS.md reference: AGENTS.md:L31-L35 Useful? React with 👍 / 👎. |
||
| ``` | ||
|
|
||
| > **Name change**: releases up to and including `2026.08.30` published this image under the misspelled name `ghcr.io/simbo1905/java.util.json.java21/jdt2jar`. Those tags remain on GHCR but are frozen; re-point to `jtd2jar`. | ||
|
|
||
| ### Build Locally | ||
|
|
||
| Requires Docker and JDK 25+ (for the build stage). Build from the repository root: | ||
|
|
||
| ```bash | ||
| docker build -t jdt2jar -f jdt2jar/Dockerfile . | ||
| docker build -t jtd2jar -f jtd2jar/Dockerfile . | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| The container's working directory is `/work`. Mount your project directory there: | ||
|
|
||
| ```bash | ||
| docker run --rm -v "$(pwd):/work" jdt2jar:latest schema.jtd.json --output schema-validator.jar --main | ||
| docker run --rm -v "$(pwd):/work" jtd2jar:latest schema.jtd.json --output schema-validator.jar --main | ||
| ``` | ||
|
|
||
| Validate a payload with the generated JAR: | ||
|
|
@@ -64,18 +66,18 @@ java -jar schema-validator.jar --validate payload.json | |
| Or validate inside a container: | ||
|
|
||
| ```bash | ||
| docker run --rm -v "$(pwd):/work" --entrypoint /jre/bin/java jdt2jar:latest -jar /work/schema-validator.jar --validate /work/payload.json | ||
| docker run --rm -v "$(pwd):/work" --entrypoint /jre/bin/java jtd2jar:latest -jar /work/schema-validator.jar --validate /work/payload.json | ||
| ``` | ||
|
|
||
| ### Helper Script | ||
|
|
||
| For environments where volume mounts are restricted (e.g., Colima on macOS with projects outside `~/`), use the helper script: | ||
|
|
||
| ```bash | ||
| ./scripts/jdt2jar.sh schema.jtd.json --output schema-validator.jar --main | ||
| ./scripts/jtd2jar.sh schema.jtd.json --output schema-validator.jar --main | ||
| ``` | ||
|
|
||
| The script syncs source to `~/tmp/jdt2jar-work`, runs the container, and syncs output back. | ||
| The script syncs source to `~/tmp/jtd2jar-work`, runs the container, and syncs output back. | ||
|
|
||
| ### Image Properties | ||
|
|
||
|
|
@@ -89,6 +91,6 @@ The script syncs source to `~/tmp/jdt2jar-work`, runs the container, and syncs o | |
| ### Security Scanning | ||
|
|
||
| ```bash | ||
| syft packages image:ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest | ||
| grype ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest | ||
| syft packages image:ghcr.io/simbo1905/java.util.json.java21/jtd2jar:latest | ||
| grype ghcr.io/simbo1905/java.util.json.java21/jtd2jar:latest | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the first renamed release, the
Create GitHub Release with notesstep runs before this workflow opens the back-merge PR, somain/jtd2jar/README.mddoes not yet exist and this usage link is broken until that PR is manually merged. Link to the release tag (for example${{ github.ref_name }}) rather thanmainso the documentation is available when the release is published.AGENTS.md reference: AGENTS.md:L31-L35
Useful? React with 👍 / 👎.