|
8 | 8 | /// Supported JTD subset: |
9 | 9 | /// - root: `properties`, `optionalProperties`, `metadata.id` |
10 | 10 | /// - leaf: `{}` (empty form), `{ "type": ... }`, `{ "enum": [...] }` |
11 | | -sealed interface JtdNode permits JtdNode.SchemaNode, JtdNode.PropertyNode, JtdNode.TypeNode, JtdNode.EnumNode, JtdNode.EmptyNode { |
| 11 | +public final class JtdAst { |
| 12 | + private JtdAst() {} |
12 | 13 |
|
13 | | - record SchemaNode( |
| 14 | + public sealed interface JtdNode permits SchemaNode, PropertyNode, TypeNode, EnumNode, EmptyNode {} |
| 15 | + |
| 16 | + public record SchemaNode( |
14 | 17 | String id, // metadata.id |
15 | 18 | Map<String, PropertyNode> properties, |
16 | 19 | Map<String, PropertyNode> optionalProperties |
17 | 20 | ) implements JtdNode {} |
18 | 21 |
|
19 | | - record PropertyNode(String name, JtdNode type) implements JtdNode {} |
| 22 | + public record PropertyNode(String name, JtdNode type) implements JtdNode {} |
20 | 23 |
|
21 | 24 | /// JTD primitive type keyword as a string, e.g. "string", "int32", "timestamp". |
22 | | - record TypeNode(String type) implements JtdNode {} |
| 25 | + public record TypeNode(String type) implements JtdNode {} |
23 | 26 |
|
24 | 27 | /// Enum values (strings only in RFC 8927). |
25 | | - record EnumNode(List<String> values) implements JtdNode {} |
| 28 | + public record EnumNode(List<String> values) implements JtdNode {} |
26 | 29 |
|
27 | 30 | /// Empty form `{}`: accepts any JSON value. |
28 | | - record EmptyNode() implements JtdNode {} |
| 31 | + public record EmptyNode() implements JtdNode {} |
29 | 32 | } |
30 | 33 |
|
0 commit comments