Skip to content

Commit 4539bd4

Browse files
authored
Merge pull request #1057 from json-schema-org/metaschema-2020-12-update
Meta-schema 2020-12 update
2 parents 6c5b672 + 7647c6f commit 4539bd4

File tree

5 files changed

+65
-52
lines changed

5 files changed

+65
-52
lines changed

meta/applicator.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"prefixItems": { "$ref": "#/$defs/schemaArray" },
1313
"items": { "$dynamicRef": "#meta" },
1414
"contains": { "$dynamicRef": "#meta" },
15-
"additionalProperties": { "$dynamicRef": "#meta" },
15+
"additionalProperties": {
16+
"$dynamicRef": "#meta",
17+
"default": {}
18+
},
1619
"properties": {
1720
"type": "object",
1821
"additionalProperties": { "$dynamicRef": "#meta" },
@@ -26,11 +29,13 @@
2629
},
2730
"dependentSchemas": {
2831
"type": "object",
29-
"additionalProperties": {
30-
"$dynamicRef": "#meta"
31-
}
32+
"additionalProperties": { "$dynamicRef": "#meta" },
33+
"default": {}
34+
},
35+
"propertyNames": {
36+
"$dynamicRef": "#meta",
37+
"default": {}
3238
},
33-
"propertyNames": { "$dynamicRef": "#meta" },
3439
"if": { "$dynamicRef": "#meta" },
3540
"then": { "$dynamicRef": "#meta" },
3641
"else": { "$dynamicRef": "#meta" },

meta/content.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
"type": ["object", "boolean"],
1212
"properties": {
13-
"contentMediaType": { "type": "string" },
1413
"contentEncoding": { "type": "string" },
14+
"contentMediaType": { "type": "string" },
1515
"contentSchema": { "$dynamicRef": "#meta" }
1616
}
1717
}

meta/core.json

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,18 @@
1010
"type": ["object", "boolean"],
1111
"properties": {
1212
"$id": {
13-
"type": "string",
14-
"format": "uri-reference",
13+
"$ref": "#/$defs/uriReferenceString",
1514
"$comment": "Non-empty fragments not allowed.",
1615
"pattern": "^[^#]*#?$"
1716
},
18-
"$schema": {
19-
"type": "string",
20-
"format": "uri"
21-
},
22-
"$anchor": {
23-
"type": "string",
24-
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
25-
},
26-
"$ref": {
27-
"type": "string",
28-
"format": "uri-reference"
29-
},
30-
"$dynamicRef": {
31-
"type": "string",
32-
"format": "uri-reference"
33-
},
34-
"$dynamicAnchor": {
35-
"type": "string",
36-
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
37-
},
17+
"$schema": { "$ref": "#/$defs/uriString" },
18+
"$ref": { "$ref": "#/$defs/uriReferenceString" },
19+
"$anchor": { "$ref": "#/$defs/anchorString" },
20+
"$dynamicRef": { "$ref": "#/$defs/uriReferenceString" },
21+
"$dynamicAnchor": { "$ref": "#/$defs/anchorString" },
3822
"$vocabulary": {
3923
"type": "object",
40-
"propertyNames": {
41-
"type": "string",
42-
"format": "uri"
43-
},
24+
"propertyNames": { "$ref": "#/$defs/uriString" },
4425
"additionalProperties": {
4526
"type": "boolean"
4627
}
@@ -53,5 +34,19 @@
5334
"additionalProperties": { "$dynamicRef": "#meta" },
5435
"default": {}
5536
}
37+
},
38+
"$defs": {
39+
"anchorString": {
40+
"type": "string",
41+
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
42+
},
43+
"uriString": {
44+
"type": "string",
45+
"format": "uri"
46+
},
47+
"uriReferenceString": {
48+
"type": "string",
49+
"format": "uri-reference"
50+
}
5651
}
5752
}

meta/validation.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
"title": "Validation vocabulary meta-schema",
1010
"type": ["object", "boolean"],
1111
"properties": {
12+
"type": {
13+
"anyOf": [
14+
{ "$ref": "#/$defs/simpleTypes" },
15+
{
16+
"type": "array",
17+
"items": { "$ref": "#/$defs/simpleTypes" },
18+
"minItems": 1,
19+
"uniqueItems": true
20+
}
21+
]
22+
},
23+
"const": true,
24+
"enum": {
25+
"type": "array",
26+
"items": true
27+
},
1228
"multipleOf": {
1329
"type": "number",
1430
"exclusiveMinimum": 0
@@ -50,22 +66,6 @@
5066
"additionalProperties": {
5167
"$ref": "#/$defs/stringArray"
5268
}
53-
},
54-
"const": true,
55-
"enum": {
56-
"type": "array",
57-
"items": true
58-
},
59-
"type": {
60-
"anyOf": [
61-
{ "$ref": "#/$defs/simpleTypes" },
62-
{
63-
"type": "array",
64-
"items": { "$ref": "#/$defs/simpleTypes" },
65-
"minItems": 1,
66-
"uniqueItems": true
67-
}
68-
]
6969
}
7070
},
7171
"$defs": {

schema.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,35 @@
2222
{"$ref": "meta/content"}
2323
],
2424
"type": ["object", "boolean"],
25+
"$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
2526
"properties": {
2627
"definitions": {
27-
"$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",
28+
"$comment": "\"definitions\" has been replaced by \"$defs\".",
2829
"type": "object",
2930
"additionalProperties": { "$dynamicRef": "#meta" },
30-
"default": {}
31+
"default": {},
32+
"deprecated": true
3133
},
3234
"dependencies": {
33-
"$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"",
35+
"$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.",
3436
"type": "object",
3537
"additionalProperties": {
3638
"anyOf": [
3739
{ "$dynamicRef": "#meta" },
3840
{ "$ref": "meta/validation#/$defs/stringArray" }
3941
]
40-
}
42+
},
43+
"deprecated": true
44+
},
45+
"$recursiveAnchor": {
46+
"$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",
47+
"$ref": "meta/core#/$defs/anchorString",
48+
"deprecated": true
49+
},
50+
"$recursiveRef": {
51+
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
52+
"$ref": "meta/core#/$defs/uriReferenceString",
53+
"deprecated": true
4154
}
4255
}
4356
}

0 commit comments

Comments
 (0)