Skip to content

Commit 625e12c

Browse files
authored
Merge pull request #655 from handrews/meta-recurse
$recursiveRef part 3 of 3: Update meta-schemas
2 parents 29fdf06 + 8d0b831 commit 625e12c

File tree

3 files changed

+28
-74
lines changed

3 files changed

+28
-74
lines changed

hyper-schema.json

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,19 @@
11
{
22
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
3-
"$id": "http://json-schema.org/draft-08/hyper-schema#",
3+
"$id": "http://json-schema.org/draft-08/hyper-schema",
4+
"$recursiveAnchor": true,
5+
46
"title": "JSON Hyper-Schema",
5-
"$defs": {
6-
"schemaArray": {
7-
"allOf": [
8-
{ "$ref": "http://json-schema.org/draft-08/schema#/$defs/schemaArray" },
9-
{
10-
"items": { "$ref": "#" }
11-
}
12-
]
13-
}
14-
},
15-
"allOf": [ { "$ref": "http://json-schema.org/draft-08/schema#" } ],
7+
"$ref": "http://json-schema.org/draft-08/schema",
168
"properties": {
17-
"additionalItems": { "$ref": "#" },
18-
"additionalProperties": { "$ref": "#"},
19-
"dependentSchemas": { "$ref": "#" },
20-
"dependencies": {
21-
"$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"",
22-
"additionalProperties": {
23-
"anyOf": [
24-
{ "$ref": "#" },
25-
{ "type": "array" }
26-
]
27-
}
28-
},
29-
"items": {
30-
"anyOf": [
31-
{ "$ref": "#" },
32-
{ "$ref": "#/$defs/schemaArray" }
33-
]
34-
},
35-
"$defs": {
36-
"additionalProperties": { "$ref": "#" }
37-
},
38-
"definitions": {
39-
"$comment": "Renamed to $defs, but retained here to ensure compatibility",
40-
"additionalProperties": { "$ref": "#" }
41-
},
42-
"patternProperties": {
43-
"additionalProperties": { "$ref": "#" }
44-
},
45-
"properties": {
46-
"additionalProperties": { "$ref": "#" }
47-
},
48-
"if": { "$ref": "#" },
49-
"then": { "$ref": "#" },
50-
"else": { "$ref": "#" },
51-
"allOf": { "$ref": "#/$defs/schemaArray" },
52-
"anyOf": { "$ref": "#/$defs/schemaArray" },
53-
"oneOf": { "$ref": "#/$defs/schemaArray" },
54-
"not": { "$ref": "#" },
55-
"contains": { "$ref": "#" },
56-
"propertyNames": { "$ref": "#" },
579
"base": {
5810
"type": "string",
5911
"format": "uri-template"
6012
},
6113
"links": {
6214
"type": "array",
6315
"items": {
64-
"$ref": "http://json-schema.org/draft-08/links#"
16+
"$ref": "http://json-schema.org/draft-08/links"
6517
}
6618
}
6719
},

links.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
3-
"$id": "http://json-schema.org/draft-08/links#",
3+
"$id": "http://json-schema.org/draft-08/links",
44
"title": "Link Description Object",
55
"allOf": [
66
{ "required": [ "rel", "href" ] },
@@ -36,7 +36,7 @@
3636
"format": "uri-template"
3737
},
3838
"hrefSchema": {
39-
"$ref": "http://json-schema.org/draft-08/hyper-schema#",
39+
"$recursiveRef": "http://json-schema.org/draft-08/hyper-schema",
4040
"default": false
4141
},
4242
"templatePointers": {
@@ -63,23 +63,23 @@
6363
"type": "string"
6464
},
6565
"targetSchema": {
66-
"$ref": "http://json-schema.org/draft-08/hyper-schema#",
66+
"$recursiveRef": "http://json-schema.org/draft-08/hyper-schema",
6767
"default": true
6868
},
6969
"targetMediaType": {
7070
"type": "string"
7171
},
7272
"targetHints": { },
7373
"headerSchema": {
74-
"$ref": "http://json-schema.org/draft-08/hyper-schema#",
74+
"$recursiveRef": "http://json-schema.org/draft-08/hyper-schema",
7575
"default": true
7676
},
7777
"submissionMediaType": {
7878
"type": "string",
7979
"default": "application/json"
8080
},
8181
"submissionSchema": {
82-
"$ref": "http://json-schema.org/draft-08/hyper-schema#",
82+
"$recursiveRef": "http://json-schema.org/draft-08/hyper-schema",
8383
"default": true
8484
},
8585
"$comment": {

schema.json

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"$schema": "http://json-schema.org/draft-08/schema#",
33
"$id": "http://json-schema.org/draft-08/schema#",
4+
"$recursiveAnchor": true,
5+
46
"title": "Core schema meta-schema",
57
"$defs": {
68
"schemaArray": {
79
"type": "array",
810
"minItems": 1,
9-
"items": { "$ref": "#" }
11+
"items": { "$recursiveRef": "#" }
1012
},
1113
"nonNegativeInteger": {
1214
"type": "integer",
@@ -55,13 +57,13 @@
5557
},
5658
"$defs": {
5759
"type": "object",
58-
"additionalProperties": { "$ref": "#" },
60+
"additionalProperties": { "$recursiveRef": "#" },
5961
"default": {}
6062
},
6163
"definitions": {
6264
"$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.",
6365
"type": "object",
64-
"additionalProperties": { "$ref": "#" },
66+
"additionalProperties": { "$recursiveRef": "#" },
6567
"default": {}
6668
},
6769
"title": {
@@ -101,10 +103,10 @@
101103
"type": "string",
102104
"format": "regex"
103105
},
104-
"additionalItems": { "$ref": "#" },
106+
"additionalItems": { "$recursiveRef": "#" },
105107
"items": {
106108
"anyOf": [
107-
{ "$ref": "#" },
109+
{ "$recursiveRef": "#" },
108110
{ "$ref": "#/$defs/schemaArray" }
109111
]
110112
},
@@ -114,26 +116,26 @@
114116
"type": "boolean",
115117
"default": false
116118
},
117-
"contains": { "$ref": "#" },
119+
"contains": { "$recursiveRef": "#" },
118120
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
119121
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
120122
"required": { "$ref": "#/$defs/stringArray" },
121-
"additionalProperties": { "$ref": "#" },
123+
"additionalProperties": { "$recursiveRef": "#" },
122124
"properties": {
123125
"type": "object",
124-
"additionalProperties": { "$ref": "#" },
126+
"additionalProperties": { "$recursiveRef": "#" },
125127
"default": {}
126128
},
127129
"patternProperties": {
128130
"type": "object",
129-
"additionalProperties": { "$ref": "#" },
131+
"additionalProperties": { "$recursiveRef": "#" },
130132
"propertyNames": { "format": "regex" },
131133
"default": {}
132134
},
133135
"dependentSchemas": {
134136
"type": "object",
135137
"additionalProperties": {
136-
"$ref": "#"
138+
"$recursiveRef": "#"
137139
}
138140
},
139141
"dependentRequired": {
@@ -147,12 +149,12 @@
147149
"type": "object",
148150
"additionalProperties": {
149151
"anyOf": [
150-
{ "$ref": "#" },
152+
{ "$recursiveRef": "#" },
151153
{ "$ref": "#/$defs/stringArray" }
152154
]
153155
}
154156
},
155-
"propertyNames": { "$ref": "#" },
157+
"propertyNames": { "$recursiveRef": "#" },
156158
"const": true,
157159
"enum": {
158160
"type": "array",
@@ -174,12 +176,12 @@
174176
"format": { "type": "string" },
175177
"contentMediaType": { "type": "string" },
176178
"contentEncoding": { "type": "string" },
177-
"if": { "$ref": "#" },
178-
"then": { "$ref": "#" },
179-
"else": { "$ref": "#" },
179+
"if": { "$recursiveRef": "#" },
180+
"then": { "$recursiveRef": "#" },
181+
"else": { "$recursiveRef": "#" },
180182
"allOf": { "$ref": "#/$defs/schemaArray" },
181183
"anyOf": { "$ref": "#/$defs/schemaArray" },
182184
"oneOf": { "$ref": "#/$defs/schemaArray" },
183-
"not": { "$ref": "#" }
185+
"not": { "$recursiveRef": "#" }
184186
}
185187
}

0 commit comments

Comments
 (0)