You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 2, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: learn/file-system.md
+47-47Lines changed: 47 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -66,24 +66,24 @@ We will start with a base JSON Schema expressing the following constraints:
66
66
67
67
Building out our JSON Schema from top to bottom:
68
68
69
-
* The [`$id`](http://json-schema.org/latest/json-schema-core.html#rfc.section.8.2) keyword.
70
-
* The [`$schema`](http://json-schema.org/latest/json-schema-core.html#rfc.section.7) keyword.
71
-
* The [`type`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1) validation keyword.
72
-
* The [`required`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3) validation keyword.
73
-
* The [`properties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4) validation keyword.
69
+
* The [`$id`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1) keyword.
70
+
* The [`$schema`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.1.1) keyword.
71
+
* The [`type`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1) validation keyword.
72
+
* The [`required`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3) validation keyword.
73
+
* The [`properties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.1) validation keyword.
74
74
* The `/` key is empty now; We will fill it out later.
75
-
* The [`patternProperties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5) validation keyword.
75
+
* The [`patternProperties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.2) validation keyword.
76
76
* This matches other property names via a regular expression. Note: it does not match `/`.
77
77
* The `^(/[^/]+)+$` key is empty now; We will fill it out later.
78
-
* The [`additionalProperties`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6) validation keyword.
78
+
* The [`additionalProperties`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.2.3) validation keyword.
79
79
* The value here is `false` to constrain object properties to be either `/` or to match the regular expression.
80
80
81
81
> You will notice that the regular expression is explicitly anchored (with `^` and `$`): in JSON Schema, regular expressions (in `patternProperties` and in `pattern`) are not anchored by default.
Let's now extend this skeleton to add constraints to some of the properties.
144
144
145
-
* Our `fstype` key uses the [`enum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2) validation keyword.
145
+
* Our `fstype` key uses the [`enum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.2) validation keyword.
146
146
* Our `options` key uses the following:
147
147
* The `type` validation keyword (see above).
148
-
* The [`minItems`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4) validation keyword.
149
-
* The [`items`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1) validation keyword.
150
-
* The [`uniqueItems`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.5) validation keyword.
148
+
* The [`minItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.2) validation keyword.
149
+
* The [`items`](http://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.10.3.1.2) validation keyword.
150
+
* The [`uniqueItems`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.4.3) validation keyword.
151
151
* Together these say: `options` must be an array, and the items therein must be strings, there must be at least one item, and all items should be unique.
152
152
* We have a `readonly` key.
153
153
154
154
With these added constraints, the schema now looks like this:
@@ -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": {},
@@ -198,7 +198,7 @@ With these added constraints, the schema now looks like this:
198
198
199
199
One new keyword is introduced here:
200
200
201
-
* The [`pattern`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*.
201
+
* The [`pattern`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.3.3) validation keyword notes the `device` key must be an absolute path starting with */dev*.
202
202
203
203
```json
204
204
{
@@ -246,7 +246,7 @@ We do have a new key: `label` and the `pattern` validation keyword states it mus
246
246
247
247
We find another new keyword:
248
248
249
-
* The [`format`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.7) annotation and assertion keyword.
249
+
* The [`format`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.7) annotation and assertion keyword.
250
250
251
251
```json
252
252
{
@@ -276,8 +276,8 @@ We find another new keyword:
276
276
277
277
Our last definition introduces two new keywords:
278
278
279
-
* The [`minimum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4) validation keyword.
280
-
* The [`maximum`](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2) validation keword.
279
+
* The [`minimum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.4) validation keyword.
280
+
* The [`maximum`](http://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.2) validation keword.
281
281
* Together these require the size be between 16 and 512, inclusive.
282
282
283
283
```json
@@ -303,19 +303,19 @@ The resulting schema is quite large:
0 commit comments