|
| 1 | +# Schema.Specification |
| 2 | + |
| 3 | +TypeBox aims for full specification compliance with the latest JSON Schema drafts as well as broad support for previous draft versions. It employs a progressive keyword adoption strategy where it implements keyword semantics as defined by newer drafts, and where keyword backwards compatibility is supported if the keyword can be implemented without conflict on newer versions. |
| 4 | + |
| 5 | +> ⚠️ Specification alignment is a ongoing effort. While TypeBox tests in excess of 95% + of the Required Keyword suite, keywords such as `$dynamicRef`, `$dynamicAnchor` are yet to be implemented by the compiler. TypeBox aims to support these along with additional `v1` keywords while retaining broad compatibility for Draft 7. |
| 6 | +
|
| 7 | +## Required Keywords |
| 8 | + |
| 9 | +These keywords form the core of TypeBox's compliance target. A ✅ indicates full passage of all test cases for that keyword under the given draft. Fractional values (e.g. 37/45) indicate the number of passing cases out of the total available for that keyword and draft combination. A dash indicates the keyword was not defined in that draft. |
| 10 | + |
| 11 | +| Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 | |
| 12 | +|:-----|:--|:--|:--|:--|:--|:--|:--| |
| 13 | +| additionalItems | ✅ | ✅ | ✅ | ✅ | ✅ | - | - | |
| 14 | +| additionalProperties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 15 | +| allOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 16 | +| anchor | - | - | - | - | ✅ | ✅ | ✅ | |
| 17 | +| anyOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 18 | +| boolean_schema | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 19 | +| const | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 20 | +| contains | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 21 | +| content | - | - | - | - | ✅ | ✅ | ✅ | |
| 22 | +| default | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 23 | +| dependencies | 17/18 | ✅ | ✅ | ✅ | - | - | - | |
| 24 | +| dependentRequired | - | - | - | - | ✅ | ✅ | ✅ | |
| 25 | +| dependentSchemas | - | - | - | - | ✅ | ✅ | ✅ | |
| 26 | +| enum | 14/16 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 27 | +| exclusiveMaximum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 28 | +| exclusiveMinimum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 29 | +| format | ✅ | ✅ | ✅ | ✅ | ✅ | 114/133 | - | |
| 30 | +| if-then-else | - | - | - | ✅ | ✅ | ✅ | ✅ | |
| 31 | +| infinite-loop-detection | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 32 | +| items | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 33 | +| maxContains | - | - | - | - | ✅ | ✅ | ✅ | |
| 34 | +| maximum | 13/14 | 13/14 | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 35 | +| maxItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 36 | +| maxLength | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 37 | +| maxProperties | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 38 | +| minContains | - | - | - | - | ✅ | ✅ | ✅ | |
| 39 | +| minimum | 12/13 | 16/17 | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 40 | +| minItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 41 | +| minLength | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 42 | +| minProperties | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 43 | +| multipleOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 44 | +| not | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 45 | +| oneOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 46 | +| pattern | ✅ | ✅ | ✅ | ✅ | ✅ | 10/12 | 10/12 | |
| 47 | +| patternProperties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 25/26 | |
| 48 | +| prefixItems | - | - | - | - | - | ✅ | ✅ | |
| 49 | +| properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 50 | +| propertyNames | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 51 | +| recursiveRef | - | - | - | - | ✅ | - | - | |
| 52 | +| ref | 23/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 77/79 | |
| 53 | +| required | 3/4 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 54 | +| type | 73/80 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 55 | +| unevaluatedItems | - | - | - | - | 55/56 | 63/71 | 63/71 | |
| 56 | +| unevaluatedProperties | - | - | - | - | 124/125 | 123/125 | 123/125 | |
| 57 | +| uniqueItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 58 | + |
| 59 | +## Optional Keywords and Proposals |
| 60 | + |
| 61 | +Optional test suites cover supplementary keywords, format validators, and proposals that are not required for core compliance. Support is included where it can be provided without conflicting with required keyword semantics. Items prefixed with format/ are format-assertion tests for the corresponding string format. |
| 62 | + |
| 63 | +| Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 | |
| 64 | +|:-----|:--|:--|:--|:--|:--|:--|:--| |
| 65 | +| anchor | - | - | - | - | 3/4 | 3/4 | 3/4 | |
| 66 | +| bignum | 7/9 | 7/9 | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 67 | +| content | - | - | - | 6/10 | - | - | - | |
| 68 | +| cross-draft | - | - | - | 1/2 | 1/3 | 0/1 | - | |
| 69 | +| dependencies-compatibility | - | - | - | - | ✅ | ✅ | ✅ | |
| 70 | +| dynamicRef | - | - | - | - | - | 1/2 | 1/2 | |
| 71 | +| ecmascript-regex | - | 64/74 | 64/74 | 64/74 | 64/74 | 64/74 | 64/74 | |
| 72 | +| float-overflow | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 73 | +| format-annotation | - | - | - | - | - | - | 114/133 | |
| 74 | +| format-assertion | - | - | - | - | - | ✅ | - | |
| 75 | +| format/color | 3/6 | - | - | - | - | - | - | |
| 76 | +| format/date | ✅ | - | - | ✅ | ✅ | ✅ | ✅ | |
| 77 | +| format/date-time | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 78 | +| format/duration | - | - | - | - | 40/42 | 40/42 | 40/42 | |
| 79 | +| format/ecmascript-regex | 1/2 | - | - | - | - | 0/1 | 0/1 | |
| 80 | +| format/email | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 81 | +| format/host-name | 2/12 | - | - | - | - | - | - | |
| 82 | +| format/hostname | - | 27/28 | 27/28 | 37/61 | 37/61 | 37/61 | 37/61 | |
| 83 | +| format/idn-email | - | - | - | ✅ | ✅ | ✅ | ✅ | |
| 84 | +| format/idn-hostname | - | - | - | ✅ | ✅ | ✅ | ✅ | |
| 85 | +| format/ip-address | 1/3 | - | - | - | - | - | - | |
| 86 | +| format/ipv4 | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 87 | +| format/ipv6 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 88 | +| format/iri | - | - | - | ✅ | ✅ | ✅ | ✅ | |
| 89 | +| format/iri-reference | - | - | - | ✅ | ✅ | ✅ | ✅ | |
| 90 | +| format/json-pointer | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 91 | +| format/regex | ✅ | - | - | ✅ | ✅ | ✅ | ✅ | |
| 92 | +| format/relative-json-pointer | - | - | - | ✅ | ✅ | ✅ | ✅ | |
| 93 | +| format/time | 2/3 | - | - | ✅ | ✅ | ✅ | ✅ | |
| 94 | +| format/unknown | - | ✅ | ✅ | ✅ | ✅ | ✅ | - | |
| 95 | +| format/uri | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 96 | +| format/uri-reference | - | - | 15/17 | 15/17 | 15/17 | 15/17 | 15/17 | |
| 97 | +| format/uri-template | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 98 | +| format/uuid | - | - | - | - | ✅ | ✅ | ✅ | |
| 99 | +| id | - | 2/3 | 6/7 | 6/7 | 2/3 | 2/3 | 2/3 | |
| 100 | +| no-schema | - | - | - | - | ✅ | ✅ | - | |
| 101 | +| non-bmp-regex | 9/12 | 9/12 | 9/12 | 9/12 | 9/12 | 9/12 | 9/12 | |
| 102 | +| proposals/propertyDependencies/additionalProperties | - | - | - | - | - | - | ✅ | |
| 103 | +| proposals/propertyDependencies/dynamicRef | - | - | - | - | - | - | 4/8 | |
| 104 | +| proposals/propertyDependencies/propertyDependencies | - | - | - | - | - | - | 17/21 | |
| 105 | +| proposals/propertyDependencies/unevaluatedProperties | - | - | - | - | - | - | 4/6 | |
| 106 | +| refOfUnknownKeyword | - | - | - | - | ✅ | ✅ | ✅ | |
| 107 | +| unknownKeyword | - | - | 1/3 | 1/3 | 1/3 | 1/3 | 1/3 | |
| 108 | +| zeroTerminatedFloats | 0/1 | 0/1 | - | - | - | - | - | |
0 commit comments