@@ -82,8 +82,8 @@ Building out our JSON Schema from top to bottom:
82
82
83
83
``` json
84
84
{
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" ,
87
87
"type" : " object" ,
88
88
"required" : [ " /" ],
89
89
"properties" : {
@@ -108,28 +108,28 @@ To this we add:
108
108
* The [ ` oneOf ` ] ( http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3 ) keyword.
109
109
* The [ ` $ref ` ] ( http://json-schema.org/latest/json-schema-core.html#rfc.section.8.3 ) keyword.
110
110
* 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.
112
112
* Including several key names which we will define later.
113
113
114
114
``` json
115
115
{
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" ,
118
118
"description" : " JSON Schema for an fstab entry" ,
119
119
"type" : " object" ,
120
120
"required" : [ " storage" ],
121
121
"properties" : {
122
122
"storage" : {
123
123
"type" : " object" ,
124
124
"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" }
129
129
]
130
130
}
131
131
},
132
- "definitions " : {
132
+ "$defs " : {
133
133
"diskDevice" : {},
134
134
"diskUUID" : {},
135
135
"nfs" : {},
@@ -155,19 +155,19 @@ With these added constraints, the schema now looks like this:
155
155
156
156
``` json
157
157
{
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" ,
160
160
"description" : " JSON Schema for an fstab entry" ,
161
161
"type" : " object" ,
162
162
"required" : [ " storage" ],
163
163
"properties" : {
164
164
"storage" : {
165
165
"type" : " object" ,
166
166
"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" }
171
171
]
172
172
},
173
173
"fstype" : {
@@ -185,7 +185,7 @@ With these added constraints, the schema now looks like this:
185
185
"type" : " boolean"
186
186
}
187
187
},
188
- "definitions " : {
188
+ "$defs " : {
189
189
"diskDevice" : {},
190
190
"diskUUID" : {},
191
191
"nfs" : {},
@@ -303,19 +303,19 @@ The resulting schema is quite large:
303
303
304
304
``` json
305
305
{
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" ,
308
308
"description" : " JSON Schema for an fstab entry" ,
309
309
"type" : " object" ,
310
310
"required" : [ " storage" ],
311
311
"properties" : {
312
312
"storage" : {
313
313
"type" : " object" ,
314
314
"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" }
319
319
]
320
320
},
321
321
"fstype" : {
@@ -333,7 +333,7 @@ The resulting schema is quite large:
333
333
"type" : " boolean"
334
334
}
335
335
},
336
- "definitions " : {
336
+ "$defs " : {
337
337
"diskDevice" : {
338
338
"properties" : {
339
339
"type" : {
@@ -404,16 +404,16 @@ Coming full circle we use the `$ref` keyword to add our entry schema into the ke
404
404
405
405
``` json
406
406
{
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" ,
409
409
"type" : " object" ,
410
410
"required" : [ " /" ],
411
411
"properties" : {
412
- "/" : { "$ref" : " http ://example.com/entry-schema" }
412
+ "/" : { "$ref" : " https ://example.com/entry-schema" }
413
413
},
414
414
"patternProperties" : {
415
- "^(/[^/]+)+$" : { "$ref" : " http ://example.com/entry-schema" }
415
+ "^(/[^/]+)+$" : { "$ref" : " https ://example.com/entry-schema" }
416
416
},
417
- "additionalProperties" : false ,
417
+ "additionalProperties" : false
418
418
}
419
419
```
0 commit comments