|
1 | 1 | # JSON Schema Codegen |
2 | 2 |
|
3 | | -> Convert JSON Schema to the type systems of a growing amount of programming |
4 | | -languages. |
| 3 | +> Generate type definitions from JSON Schema for multiple programming languages |
5 | 4 |
|
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. |
| 5 | +Existing tools in this space typically support limited subsets of JSON Schema |
| 6 | +with varying compliance levels. This project, maintained by a member of the |
| 7 | +[JSON Schema Technical Steering Committee](https://github.com/jviotti), |
| 8 | +prioritizes specification compliance and comprehensive keyword coverage. |
11 | 9 |
|
12 | 10 | ## Keyword Support |
13 | 11 |
|
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. |
| 12 | +Not every JSON Schema keyword maps directly to type system constructs. This |
| 13 | +implementation aims to provide complete structural typing, and you are expected |
| 14 | +to use a JSON Schema validator at runtime to enforce remaining constraints. |
18 | 15 |
|
19 | 16 | | Vocabulary | Keyword | TypeScript | |
20 | 17 | |------------|---------|------------| |
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 | |
| 18 | +| Core (2020-12) | `$schema` | Yes | |
| 19 | +| Core (2020-12) | `$id` | Yes | |
| 20 | +| Core (2020-12) | `$ref` | Yes | |
| 21 | +| Core (2020-12) | `$defs` | Yes | |
| 22 | +| Core (2020-12) | `$anchor` | Yes | |
| 23 | +| Core (2020-12) | `$dynamicAnchor` | Pending | |
| 24 | +| Core (2020-12) | `$dynamicRef` | Pending | |
| 25 | +| Core (2020-12) | `$vocabulary` | Ignored | |
| 26 | +| Core (2020-12) | `$comment` | Ignored | |
| 27 | +| Applicator (2020-12) | `properties` | Yes | |
| 28 | +| Applicator (2020-12) | `additionalProperties` | Yes | |
| 29 | +| Applicator (2020-12) | `items` | Yes | |
| 30 | +| Applicator (2020-12) | `prefixItems` | Yes | |
| 31 | +| Applicator (2020-12) | `anyOf` | Yes | |
| 32 | +| Applicator (2020-12) | `patternProperties` | **CANNOT SUPPORT** | |
| 33 | +| Applicator (2020-12) | `propertyNames` | Ignored | |
| 34 | +| Applicator (2020-12) | `dependentSchemas` | Pending | |
| 35 | +| Applicator (2020-12) | `contains` | Ignored | |
| 36 | +| Applicator (2020-12) | `allOf` | Pending | |
| 37 | +| Applicator (2020-12) | `oneOf` | **CANNOT SUPPORT** | |
| 38 | +| Applicator (2020-12) | `not` | **CANNOT SUPPORT** | |
| 39 | +| Applicator (2020-12) | `if` | Pending | |
| 40 | +| Applicator (2020-12) | `then` | Pending | |
| 41 | +| Applicator (2020-12) | `else` | Pending | |
| 42 | +| Validation (2020-12) | `type` | Yes | |
| 43 | +| Validation (2020-12) | `enum` | Yes | |
| 44 | +| Validation (2020-12) | `required` | Yes | |
| 45 | +| Validation (2020-12) | `const` | Yes | |
| 46 | +| Validation (2020-12) | `minLength` | Ignored | |
| 47 | +| Validation (2020-12) | `maxLength` | Ignored | |
| 48 | +| Validation (2020-12) | `pattern` | Ignored | |
| 49 | +| Validation (2020-12) | `minimum` | Ignored | |
| 50 | +| Validation (2020-12) | `maximum` | Ignored | |
| 51 | +| Validation (2020-12) | `exclusiveMinimum` | Ignored | |
| 52 | +| Validation (2020-12) | `exclusiveMaximum` | Ignored | |
| 53 | +| Validation (2020-12) | `multipleOf` | Ignored | |
| 54 | +| Validation (2020-12) | `minProperties` | Ignored | |
| 55 | +| Validation (2020-12) | `maxProperties` | Ignored | |
| 56 | +| Validation (2020-12) | `dependentRequired` | Pending | |
| 57 | +| Validation (2020-12) | `minItems` | Ignored | |
| 58 | +| Validation (2020-12) | `maxItems` | Ignored | |
| 59 | +| Validation (2020-12) | `minContains` | Ignored | |
| 60 | +| Validation (2020-12) | `maxContains` | Ignored | |
| 61 | +| Validation (2020-12) | `uniqueItems` | Ignored | |
| 62 | +| Unevaluated (2020-12) | `unevaluatedItems` | Pending | |
| 63 | +| Unevaluated (2020-12) | `unevaluatedProperties` | Pending | |
| 64 | +| Meta-Data (2020-12) | `title` | Ignored | |
| 65 | +| Meta-Data (2020-12) | `description` | Ignored | |
| 66 | +| Meta-Data (2020-12) | `default` | Ignored | |
| 67 | +| Meta-Data (2020-12) | `deprecated` | Ignored | |
| 68 | +| Meta-Data (2020-12) | `examples` | Ignored | |
| 69 | +| Meta-Data (2020-12) | `readOnly` | Ignored | |
| 70 | +| Meta-Data (2020-12) | `writeOnly` | Ignored | |
| 71 | +| Format Annotation (2020-12) | `format` | Ignored | |
| 72 | +| Format Assertion (2020-12) | `format` | Ignored | |
| 73 | +| Content (2020-12) | `contentEncoding` | Ignored | |
| 74 | +| Content (2020-12) | `contentMediaType` | Ignored | |
| 75 | +| Content (2020-12) | `contentSchema` | Ignored | |
79 | 76 |
|
80 | 77 | Support for other JSON Schema dialects coming soon. |
0 commit comments