feat(java): add SchemaGenerator compile-time type-to-JSON-Schema utility#1766
Draft
Copilot wants to merge 3 commits into
Draft
feat(java): add SchemaGenerator compile-time type-to-JSON-Schema utility#1766Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Creates SchemaGenerator.java that maps javax.lang.model TypeMirror instances to JSON Schema source code literals (Map.of(...) expressions). Implements all 24 type mappings from the specification including: - Primitives and boxed types (int/Integer, long/Long, etc.) - String, UUID, OffsetDateTime - Collections (List<T>, Collection<T>, Set<T>) - Maps (Map<String, V> with typed values) - Arrays (String[]) - Enums (with constant enumeration) - Records and POJOs (with properties/required) - Optional<T>, OptionalInt, OptionalDouble - Sealed interfaces (oneOf) - JsonNode and Object (any) Also adds SchemaGeneratorTest using compilation-testing approach with javax.tools.JavaCompiler to exercise the generator at compile time. Closes #1759
Copilot
AI
changed the title
[WIP] Add schema generation utility for TypeMirror to JSON Schema
feat(java): add SchemaGenerator compile-time type-to-JSON-Schema utility
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compile-time schema generation utility that maps
javax.lang.modeltypes to JSON Schema represented asMap.of(...)source code literals, for use by the annotation processor (task 4.2 of the tool ergonomics plan).SchemaGenerator.javajavax.lang.modelAPIs — nojava.lang.reflectgenerateSchemaSource(TypeMirror, Types, Elements)→ schema source for a single typegenerateParametersSchemaSource(List<VariableElement>, Types, Elements)→ full parameters object schema with properties/requiredSchemaGeneratorTest.javajavax.tools.JavaCompilerand a customSchemaCapturingProcessorthat exercisesSchemaGeneratorduring annotation processing