Skip to content

Commit 83ecb94

Browse files
committed
Specification (#1559)
* Specification * Documentation
1 parent 735e9c5 commit 83ecb94

560 files changed

Lines changed: 43890 additions & 17359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deno.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"publish": "deno run -A tasks.ts publish", // Publish Package
1212
"report": "deno run -A tasks.ts report", // Test Converage
1313
"range": "deno run -A tasks.ts range", // TypeScript Compiler Ranges
14+
"spec": "deno run -A tasks.ts spec", // Refresh JSON Schema Spec
1415
"start": "deno run -A tasks.ts start", // Run Example
1516
"syntax": "deno run -A tasks.ts syntax", // Build Parsers
1617
"test": "deno run -A tasks.ts test", // Test Project

design/website/app/frontend/components/docs/docs.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,67 @@ THE SOFTWARE.
214214
padding: 0;
215215
display: block;
216216
}
217+
/* ------------------------------------------------------------------
218+
TABLE LAYOUT
219+
------------------------------------------------------------------ */
220+
.docs .content .docs-table-wrap {
221+
overflow-x: auto;
222+
margin: 1.25rem 0;
223+
}
224+
.docs .content table {
225+
width: 100%;
226+
border-collapse: collapse;
227+
font-size: 0.875rem;
228+
font-family: var(--app-font-family-standard);
229+
table-layout: auto;
230+
}
231+
.docs .content table thead tr {
232+
background: var(--docs-menu-background-color);
233+
border-bottom: 2px solid var(--docs-search-border-color);
234+
}
235+
.docs .content table thead th {
236+
color: var(--docs-text-color-muted);
237+
font-weight: 500;
238+
text-align: left;
239+
padding: 0.6rem 1rem;
240+
white-space: nowrap;
241+
font-size: 0.78rem;
242+
letter-spacing: 0.03em;
243+
text-transform: uppercase;
244+
}
245+
.docs .content table thead th:first-child {
246+
border-left: 4px solid var(--docs-text-color-select);
247+
}
248+
.docs .content table tbody tr {
249+
border-bottom: 1px solid var(--docs-blockquote-border-color);
250+
}
251+
.docs .content table tbody tr:last-child {
252+
border-bottom: none;
253+
}
254+
.docs .content table tbody tr:hover {
255+
background: var(--docs-menu-background-color);
256+
}
257+
.docs .content table tbody td {
258+
padding: 0.6rem 1rem;
259+
color: var(--docs-text-color);
260+
vertical-align: middle;
261+
line-height: 1.6;
262+
}
263+
.docs .content table tbody td:first-child {
264+
border-left: 4px solid transparent;
265+
}
266+
.docs .content table tbody tr:hover td:first-child {
267+
border-left-color: var(--docs-text-color-select);
268+
}
269+
.docs .content table tfoot tr {
270+
border-top: 1px solid var(--docs-search-border-color);
271+
background: var(--docs-menu-background-color);
272+
}
273+
.docs .content table tfoot td {
274+
padding: 0.5rem 1rem;
275+
font-size: 0.78rem;
276+
color: var(--docs-text-color-muted);
277+
}
217278
/* ------------------------------------------------------------------
218279
PrismJS syntax highlighting
219280
------------------------------------------------------------------ */
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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 | - | - | - | - | - |

design/website/docs/schema/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ High Performance JSON Schema Validator
44

55
## Overview
66

7-
TypeBox includes a high performance validation compiler for JSON Schema. The compiler supports both TypeBox and native JSON Schema schematics, and will convert them into optimized runtime validation routines. The compiler is designed to be a lightweight 2020-12 spec compliant alternative to Ajv for high-throughput applications.
7+
TypeBox includes a JSON Schema compiler designed for high-performance JIT validation. It also provides automatic fallback to dynamic interpreted checking for JIT restrictive environments such as Cloudflare Workers. The compiler is designed to be a lightweight, spec compliant alternative to Ajv for high-throughput applications based on the JSON Schema standard.
88

99
### Example
1010

design/website/docs/type/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ JSON Schema Type Builder with Static Type Resolution for TypeScript
44

55
## Overview
66

7-
TypeBox types are JSON Schema fragments that can compose into more complex types. The library offers a set of types used to construct JSON Schema compliant schematics as well as a set of extended types used to model constructs native to the JavaScript language. The schematics produced by TypeBox can be passed directly to any JSON Schema compliant validator.
7+
TypeBox types are JSON Schema fragments that compose into more complex types. The library offers a set of types used to construct JSON Schema compliant schematics as well as a set of extended types used to model constructs native to the JavaScript language. The schematics produced by TypeBox can be passed directly to any JSON Schema compliant validator.
88

99
## Example
1010

0 commit comments

Comments
 (0)