|
1 | | -Codegen |
2 | | -======= |
| 1 | +# JSON Schema Codegen |
3 | 2 |
|
4 | | -- Each input schema corresponds to a single `.d.ts` file |
5 | | -- 100% structurally map to TypeScript. Additional constraints might belong to |
6 | | - validation |
| 3 | +> Convert JSON Schema to the type systems of a growing amount of programming |
| 4 | +languages. |
7 | 5 |
|
8 | | -| Vocabulary | Keyword | Support | |
9 | | -|------------|---------|---------| |
10 | | -| Core | `$schema` | Yes | |
11 | | -| Core | `$id` | Yes | |
12 | | -| Core | `$ref` | Yes | |
13 | | -| Core | `$defs` | Yes | |
14 | | -| Core | `$anchor` | Yes | |
15 | | -| Core | `$dynamicAnchor` | No (TODO: Simplify in canonicalisation) | |
16 | | -| Core | `$dynamicRef` | No (TODO: Simplify in canonicalisation) | |
17 | | -| Core | `$vocabulary` | Ignored | |
18 | | -| Core | `$comment` | Ignored | |
19 | | -| Applicator | `properties` | Yes | |
20 | | -| Applicator | `additionalProperties` | Yes | |
21 | | -| Applicator | `items` | Yes | |
22 | | -| Applicator | `prefixItems` | Yes | |
23 | | -| Applicator | `anyOf` | Yes | |
24 | | -| Applicator | `patternProperties` | CANNOT SUPPORT IN MOST LANGUAGES | |
25 | | -| Applicator | `propertyNames` | Ignored | |
26 | | -| Applicator | `dependentSchemas` | No (TODO: Simplify in canonicalisation) | |
27 | | -| Applicator | `contains` | Ignored | |
28 | | -| Applicator | `allOf` | No (TODO: Simplify in canonicalisation) | |
29 | | -| Applicator | `oneOf` | CANNOT SUPPORT IN MOST LANGUAGES | |
30 | | -| Applicator | `not` | CANNOT SUPPORT IN MOST LANGUAGES | |
31 | | -| Applicator | `if` | No (TODO: Simplify in canonicalisation) | |
32 | | -| Applicator | `then` | No (TODO: Simplify in canonicalisation) | |
33 | | -| Applicator | `else` | No (TODO: Simplify in canonicalisation) | |
34 | | -| Validation | `type` | Yes | |
35 | | -| Validation | `enum` | Yes | |
36 | | -| Validation | `required` | Yes | |
37 | | -| Validation | `const` | Yes | |
38 | | -| Validation | `minLength` | Ignored | |
39 | | -| Validation | `maxLength` | Ignored | |
40 | | -| Validation | `pattern` | Ignored | |
41 | | -| Validation | `minimum` | Ignored | |
42 | | -| Validation | `maximum` | Ignored | |
43 | | -| Validation | `exclusiveMinimum` | Ignored | |
44 | | -| Validation | `exclusiveMaximum` | Ignored | |
45 | | -| Validation | `multipleOf` | Ignored | |
46 | | -| Validation | `minProperties` | Ignored | |
47 | | -| Validation | `maxProperties` | Ignored | |
48 | | -| Validation | `dependentRequired` | No (TODO: Simplify in canonicalisation) | |
49 | | -| Validation | `minItems` | Ignored | |
50 | | -| Validation | `maxItems` | Ignored | |
51 | | -| Validation | `minContains` | Ignored | |
52 | | -| Validation | `maxContains` | Ignored | |
53 | | -| Validation | `uniqueItems` | Ignored | |
54 | | -| Unevaluated | `unevaluatedItems` | No (TODO: Simplify in canonicalisation) | |
55 | | -| Unevaluated | `unevaluatedProperties` | No (TODO: Simplify in canonicalisation) | |
56 | | -| Meta-Data | `title` | Ignored | |
57 | | -| Meta-Data | `description` | Ignored | |
58 | | -| Meta-Data | `default` | Ignored | |
59 | | -| Meta-Data | `deprecated` | Ignored | |
60 | | -| Meta-Data | `examples` | Ignored | |
61 | | -| Meta-Data | `readOnly` | Ignored | |
62 | | -| Meta-Data | `writeOnly` | Ignored | |
63 | | -| Format Annotation | `format` | Ignored | |
64 | | -| Format Assertion | `format` | Ignored | |
65 | | -| Content | `contentEncoding` | Ignored | |
66 | | -| Content | `contentMediaType` | Ignored | |
67 | | -| Content | `contentSchema` | Ignored | |
| 6 | +While this idea is not new, most community driven projects support only a basic |
| 7 | +subset of JSON Schema, and often have various compliance issues. In |
| 8 | +comparison, this project is maintained by a member of the JSON Schema Technical |
| 9 | +Steering Committee and aims for strict compliance and high coverage of the |
| 10 | +specification. |
| 11 | + |
| 12 | +## Keyword Support |
| 13 | + |
| 14 | +Note that not every keyword can be directly mapped into a type system. We aims |
| 15 | +for 100% structural coverage while you are expected to still validate the |
| 16 | +instance against the schema using traditional JSON Schema evaluator to fully |
| 17 | +apply any remaining assertions. |
| 18 | + |
| 19 | +| Vocabulary | Keyword | TypeScript | |
| 20 | +|------------|---------|------------| |
| 21 | +| JSON Schema 2020-12 Core | `$schema` | Yes | |
| 22 | +| JSON Schema 2020-12 Core | `$id` | Yes | |
| 23 | +| JSON Schema 2020-12 Core | `$ref` | Yes | |
| 24 | +| JSON Schema 2020-12 Core | `$defs` | Yes | |
| 25 | +| JSON Schema 2020-12 Core | `$anchor` | Yes | |
| 26 | +| JSON Schema 2020-12 Core | `$dynamicAnchor` | Pending | |
| 27 | +| JSON Schema 2020-12 Core | `$dynamicRef` | Pending | |
| 28 | +| JSON Schema 2020-12 Core | `$vocabulary` | Ignored | |
| 29 | +| JSON Schema 2020-12 Core | `$comment` | Ignored | |
| 30 | +| JSON Schema 2020-12 Applicator | `properties` | Yes | |
| 31 | +| JSON Schema 2020-12 Applicator | `additionalProperties` | Yes | |
| 32 | +| JSON Schema 2020-12 Applicator | `items` | Yes | |
| 33 | +| JSON Schema 2020-12 Applicator | `prefixItems` | Yes | |
| 34 | +| JSON Schema 2020-12 Applicator | `anyOf` | Yes | |
| 35 | +| JSON Schema 2020-12 Applicator | `patternProperties` | **CANNOT SUPPORT** | |
| 36 | +| JSON Schema 2020-12 Applicator | `propertyNames` | Ignored | |
| 37 | +| JSON Schema 2020-12 Applicator | `dependentSchemas` | Pending | |
| 38 | +| JSON Schema 2020-12 Applicator | `contains` | Ignored | |
| 39 | +| JSON Schema 2020-12 Applicator | `allOf` | Pending | |
| 40 | +| JSON Schema 2020-12 Applicator | `oneOf` | **CANNOT SUPPORT** | |
| 41 | +| JSON Schema 2020-12 Applicator | `not` | **CANNOT SUPPORT** | |
| 42 | +| JSON Schema 2020-12 Applicator | `if` | Pending | |
| 43 | +| JSON Schema 2020-12 Applicator | `then` | Pending | |
| 44 | +| JSON Schema 2020-12 Applicator | `else` | Pending | |
| 45 | +| JSON Schema 2020-12 Validation | `type` | Yes | |
| 46 | +| JSON Schema 2020-12 Validation | `enum` | Yes | |
| 47 | +| JSON Schema 2020-12 Validation | `required` | Yes | |
| 48 | +| JSON Schema 2020-12 Validation | `const` | Yes | |
| 49 | +| JSON Schema 2020-12 Validation | `minLength` | Ignored | |
| 50 | +| JSON Schema 2020-12 Validation | `maxLength` | Ignored | |
| 51 | +| JSON Schema 2020-12 Validation | `pattern` | Ignored | |
| 52 | +| JSON Schema 2020-12 Validation | `minimum` | Ignored | |
| 53 | +| JSON Schema 2020-12 Validation | `maximum` | Ignored | |
| 54 | +| JSON Schema 2020-12 Validation | `exclusiveMinimum` | Ignored | |
| 55 | +| JSON Schema 2020-12 Validation | `exclusiveMaximum` | Ignored | |
| 56 | +| JSON Schema 2020-12 Validation | `multipleOf` | Ignored | |
| 57 | +| JSON Schema 2020-12 Validation | `minProperties` | Ignored | |
| 58 | +| JSON Schema 2020-12 Validation | `maxProperties` | Ignored | |
| 59 | +| JSON Schema 2020-12 Validation | `dependentRequired` | Pending | |
| 60 | +| JSON Schema 2020-12 Validation | `minItems` | Ignored | |
| 61 | +| JSON Schema 2020-12 Validation | `maxItems` | Ignored | |
| 62 | +| JSON Schema 2020-12 Validation | `minContains` | Ignored | |
| 63 | +| JSON Schema 2020-12 Validation | `maxContains` | Ignored | |
| 64 | +| JSON Schema 2020-12 Validation | `uniqueItems` | Ignored | |
| 65 | +| JSON Schema 2020-12 Unevaluated | `unevaluatedItems` | Pending | |
| 66 | +| JSON Schema 2020-12 Unevaluated | `unevaluatedProperties` | Pending | |
| 67 | +| JSON Schema 2020-12 Meta-Data | `title` | Ignored | |
| 68 | +| JSON Schema 2020-12 Meta-Data | `description` | Ignored | |
| 69 | +| JSON Schema 2020-12 Meta-Data | `default` | Ignored | |
| 70 | +| JSON Schema 2020-12 Meta-Data | `deprecated` | Ignored | |
| 71 | +| JSON Schema 2020-12 Meta-Data | `examples` | Ignored | |
| 72 | +| JSON Schema 2020-12 Meta-Data | `readOnly` | Ignored | |
| 73 | +| JSON Schema 2020-12 Meta-Data | `writeOnly` | Ignored | |
| 74 | +| JSON Schema 2020-12 Format Annotation | `format` | Ignored | |
| 75 | +| JSON Schema 2020-12 Format Assertion | `format` | Ignored | |
| 76 | +| JSON Schema 2020-12 Content | `contentEncoding` | Ignored | |
| 77 | +| JSON Schema 2020-12 Content | `contentMediaType` | Ignored | |
| 78 | +| JSON Schema 2020-12 Content | `contentSchema` | Ignored | |
| 79 | + |
| 80 | +Support for other JSON Schema dialects coming soon. |
0 commit comments