Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit ec24002

Browse files
committed
Update all schemas in /learn to 2020-12
1 parent 6a9dee9 commit ec24002

7 files changed

+58
-58
lines changed

learn/examples/address.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$id": "https://example.com/address.schema.json",
3-
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"description": "An address similar to http://microformats.org/wiki/h-card",
55
"type": "object",
66
"properties": {
@@ -27,7 +27,7 @@
2727
}
2828
},
2929
"required": [ "locality", "region", "country-name" ],
30-
"dependencies": {
30+
"dependentRequired": {
3131
"post-office-box": [ "street-address" ],
3232
"extended-address": [ "street-address" ]
3333
}

learn/examples/calendar.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$id": "https://example.com/calendar.schema.json",
3-
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"description": "A representation of an event",
55
"type": "object",
66
"required": [ "dtstart", "summary" ],
@@ -41,7 +41,7 @@
4141
"type": "string"
4242
},
4343
"geo": {
44-
"$ref": "http://example.com/geographical-location.schema.json"
44+
"$ref": "https://example.com/geographical-location.schema.json"
4545
}
4646
}
4747
}

learn/examples/card.schema.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$id": "https://example.com/card.schema.json",
3-
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"description": "A representation of a person, company, organization, or place",
55
"type": "object",
66
"required": [ "familyName", "givenName" ],
@@ -61,8 +61,8 @@
6161
}
6262
}
6363
},
64-
"adr": { "$ref": "http://example.com/address.schema.json" },
65-
"geo": { "$ref": "http://example.com/geographical-location.schema.json" },
64+
"adr": { "$ref": "https://example.com/address.schema.json" },
65+
"geo": { "$ref": "https://example.com/geographical-location.schema.json" },
6666
"tz": {
6767
"type": "string"
6868
},

learn/examples/geographical-location.schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$id": "https://example.com/geographical-location.schema.json",
3-
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"title": "Longitude and Latitude Values",
55
"description": "A geographical coordinate.",
66
"required": [ "latitude", "longitude" ],

learn/file-system.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Building out our JSON Schema from top to bottom:
8282
8383
```json
8484
{
85-
"$id": "http://example.com/fstab",
86-
"$schema": "http://json-schema.org/draft-07/schema#",
85+
"$id": "https://example.com/fstab",
86+
"$schema": "https://json-schema.org/draft/2020-12/schema",
8787
"type": "object",
8888
"required": [ "/" ],
8989
"properties": {
@@ -108,28 +108,28 @@ To this we add:
108108
* The [`oneOf`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3) keyword.
109109
* The [`$ref`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3) keyword.
110110
* In this case, all references used are local to the schema using a relative fragment URI (`#/...`).
111-
* The [`definitions`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword.
111+
* The [`$defs`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword.
112112
* Including several key names which we will define later.
113113

114114
```json
115115
{
116-
"$id": "http://example.com/entry-schema",
117-
"$schema": "http://json-schema.org/draft-07/schema#",
116+
"$id": "https://example.com/entry-schema",
117+
"$schema": "https://json-schema.org/draft/2020-12/schema",
118118
"description": "JSON Schema for an fstab entry",
119119
"type": "object",
120120
"required": [ "storage" ],
121121
"properties": {
122122
"storage": {
123123
"type": "object",
124124
"oneOf": [
125-
{ "$ref": "#/definitions/diskDevice" },
126-
{ "$ref": "#/definitions/diskUUID" },
127-
{ "$ref": "#/definitions/nfs" },
128-
{ "$ref": "#/definitions/tmpfs" }
125+
{ "$ref": "#/$defs/diskDevice" },
126+
{ "$ref": "#/$defs/diskUUID" },
127+
{ "$ref": "#/$defs/nfs" },
128+
{ "$ref": "#/$defs/tmpfs" }
129129
]
130130
}
131131
},
132-
"definitions": {
132+
"$defs": {
133133
"diskDevice": {},
134134
"diskUUID": {},
135135
"nfs": {},
@@ -155,19 +155,19 @@ With these added constraints, the schema now looks like this:
155155

156156
```json
157157
{
158-
"$id": "http://example.com/entry-schema",
159-
"$schema": "http://json-schema.org/draft-07/schema#",
158+
"$id": "https://example.com/entry-schema",
159+
"$schema": "https://json-schema.org/draft/2020-12/schema",
160160
"description": "JSON Schema for an fstab entry",
161161
"type": "object",
162162
"required": [ "storage" ],
163163
"properties": {
164164
"storage": {
165165
"type": "object",
166166
"oneOf": [
167-
{ "$ref": "#/definitions/diskDevice" },
168-
{ "$ref": "#/definitions/diskUUID" },
169-
{ "$ref": "#/definitions/nfs" },
170-
{ "$ref": "#/definitions/tmpfs" }
167+
{ "$ref": "#/$defs/diskDevice" },
168+
{ "$ref": "#/$defs/diskUUID" },
169+
{ "$ref": "#/$defs/nfs" },
170+
{ "$ref": "#/$defs/tmpfs" }
171171
]
172172
},
173173
"fstype": {
@@ -185,7 +185,7 @@ With these added constraints, the schema now looks like this:
185185
"type": "boolean"
186186
}
187187
},
188-
"definitions": {
188+
"$defs": {
189189
"diskDevice": {},
190190
"diskUUID": {},
191191
"nfs": {},
@@ -303,19 +303,19 @@ The resulting schema is quite large:
303303

304304
```json
305305
{
306-
"$id": "http://example.com/entry-schema",
307-
"$schema": "http://json-schema.org/draft-07/schema#",
306+
"$id": "https://example.com/entry-schema",
307+
"$schema": "https://json-schema.org/draft/2020-12/schema",
308308
"description": "JSON Schema for an fstab entry",
309309
"type": "object",
310310
"required": [ "storage" ],
311311
"properties": {
312312
"storage": {
313313
"type": "object",
314314
"oneOf": [
315-
{ "$ref": "#/definitions/diskDevice" },
316-
{ "$ref": "#/definitions/diskUUID" },
317-
{ "$ref": "#/definitions/nfs" },
318-
{ "$ref": "#/definitions/tmpfs" }
315+
{ "$ref": "#/$defs/diskDevice" },
316+
{ "$ref": "#/$defs/diskUUID" },
317+
{ "$ref": "#/$defs/nfs" },
318+
{ "$ref": "#/$defs/tmpfs" }
319319
]
320320
},
321321
"fstype": {
@@ -333,7 +333,7 @@ The resulting schema is quite large:
333333
"type": "boolean"
334334
}
335335
},
336-
"definitions": {
336+
"$defs": {
337337
"diskDevice": {
338338
"properties": {
339339
"type": {
@@ -404,16 +404,16 @@ Coming full circle we use the `$ref` keyword to add our entry schema into the ke
404404

405405
```json
406406
{
407-
"$id": "http://example.com/fstab",
408-
"$schema": "http://json-schema.org/draft-07/schema#",
407+
"$id": "https://example.com/fstab",
408+
"$schema": "https://json-schema.org/draft/2020-12/schema",
409409
"type": "object",
410410
"required": [ "/" ],
411411
"properties": {
412-
"/": { "$ref": "http://example.com/entry-schema" }
412+
"/": { "$ref": "https://example.com/entry-schema" }
413413
},
414414
"patternProperties": {
415-
"^(/[^/]+)+$": { "$ref": "http://example.com/entry-schema" }
415+
"^(/[^/]+)+$": { "$ref": "https://example.com/entry-schema" }
416416
},
417-
"additionalProperties": false,
417+
"additionalProperties": false
418418
}
419419
```

learn/getting-started-step-by-step.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ We start with four properties called **keywords** which are expressed as [JSON](
5757

5858
```json
5959
{
60-
"$schema": "http://json-schema.org/draft-07/schema#",
61-
"$id": "http://example.com/product.schema.json",
60+
"$schema": "https://json-schema.org/draft/2020-12/schema",
61+
"$id": "https://example.com/product.schema.json",
6262
"title": "Product",
6363
"description": "A product in the catalog",
6464
"type": "object"
@@ -85,8 +85,8 @@ In JSON Schema terms, we update our schema to add:
8585

8686
```json
8787
{
88-
"$schema": "http://json-schema.org/draft-07/schema#",
89-
"$id": "http://example.com/product.schema.json",
88+
"$schema": "https://json-schema.org/draft/2020-12/schema",
89+
"$id": "https://example.com/product.schema.json",
9090
"title": "Product",
9191
"description": "A product from Acme's catalog",
9292
"type": "object",
@@ -106,8 +106,8 @@ In JSON Schema terms, we update our schema to add:
106106

107107
```json
108108
{
109-
"$schema": "http://json-schema.org/draft-07/schema#",
110-
"$id": "http://example.com/product.schema.json",
109+
"$schema": "https://json-schema.org/draft/2020-12/schema",
110+
"$id": "https://example.com/product.schema.json",
111111
"title": "Product",
112112
"description": "A product from Acme's catalog",
113113
"type": "object",
@@ -135,8 +135,8 @@ According to the store owner there are no free products. ;)
135135

136136
```json
137137
{
138-
"$schema": "http://json-schema.org/draft-07/schema#",
139-
"$id": "http://example.com/product.schema.json",
138+
"$schema": "https://json-schema.org/draft/2020-12/schema",
139+
"$id": "https://example.com/product.schema.json",
140140
"title": "Product",
141141
"description": "A product from Acme's catalog",
142142
"type": "object",
@@ -179,8 +179,8 @@ Therefore:
179179

180180
```json
181181
{
182-
"$schema": "http://json-schema.org/draft-07/schema#",
183-
"$id": "http://example.com/product.schema.json",
182+
"$schema": "https://json-schema.org/draft/2020-12/schema",
183+
"$id": "https://example.com/product.schema.json",
184184
"title": "Product",
185185
"description": "A product from Acme's catalog",
186186
"type": "object",
@@ -222,8 +222,8 @@ Up until this point we've been dealing with a very flat schema -- only one level
222222

223223
```json
224224
{
225-
"$schema": "http://json-schema.org/draft-07/schema#",
226-
"$id": "http://example.com/product.schema.json",
225+
"$schema": "https://json-schema.org/draft/2020-12/schema",
226+
"$id": "https://example.com/product.schema.json",
227227
"title": "Product",
228228
"description": "A product from Acme's catalog",
229229
"type": "object",
@@ -282,7 +282,7 @@ For this example we introduce a new JSON Schema resource and for both properties
282282
```json
283283
{
284284
"$id": "https://example.com/geographical-location.schema.json",
285-
"$schema": "http://json-schema.org/draft-07/schema#",
285+
"$schema": "https://json-schema.org/draft/2020-12/schema",
286286
"title": "Longitude and Latitude",
287287
"description": "A geographical coordinate on a planet (most commonly Earth).",
288288
"required": [ "latitude", "longitude" ],
@@ -306,8 +306,8 @@ Next we add a reference to this new schema so it can be incorporated.
306306

307307
```json
308308
{
309-
"$schema": "http://json-schema.org/draft-07/schema#",
310-
"$id": "http://example.com/product.schema.json",
309+
"$schema": "https://json-schema.org/draft/2020-12/schema",
310+
"$id": "https://example.com/product.schema.json",
311311
"title": "Product",
312312
"description": "A product from Acme's catalog",
313313
"type": "object",

learn/miscellaneous-examples.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This example provides a typical minimum you are likely to see in JSON Schema. It
2020
```json
2121
{
2222
"$id": "https://example.com/person.schema.json",
23-
"$schema": "http://json-schema.org/draft-07/schema#",
23+
"$schema": "https://json-schema.org/draft/2020-12/schema",
2424
"title": "Person",
2525
"type": "object",
2626
"properties": {
@@ -62,7 +62,7 @@ This example introduces:
6262
```json
6363
{
6464
"$id": "https://example.com/geographical-location.schema.json",
65-
"$schema": "http://json-schema.org/draft-07/schema#",
65+
"$schema": "https://json-schema.org/draft/2020-12/schema",
6666
"title": "Longitude and Latitude Values",
6767
"description": "A geographical coordinate.",
6868
"required": [ "latitude", "longitude" ],
@@ -100,13 +100,13 @@ Arrays are fundamental structures in JSON -- here we demonstrate a couple of way
100100

101101
We also introduce the following with this example:
102102

103-
* [`definitions`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword
103+
* [`$defs`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.9) keyword
104104
* [`$ref`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3) keyword
105105

106106
```json
107107
{
108108
"$id": "https://example.com/arrays.schema.json",
109-
"$schema": "http://json-schema.org/draft-07/schema#",
109+
"$schema": "https://json-schema.org/draft/2020-12/schema",
110110
"description": "A representation of a person, company, organization, or place",
111111
"type": "object",
112112
"properties": {
@@ -118,10 +118,10 @@ We also introduce the following with this example:
118118
},
119119
"vegetables": {
120120
"type": "array",
121-
"items": { "$ref": "#/definitions/veggie" }
121+
"items": { "$ref": "#/$defs/veggie" }
122122
}
123123
},
124-
"definitions": {
124+
"$defs": {
125125
"veggie": {
126126
"type": "object",
127127
"required": [ "veggieName", "veggieLike" ],

0 commit comments

Comments
 (0)