Skip to content

Commit b110f8d

Browse files
committed
No other keywords allowed beside "$ref"
The spec for $ref, whether in its own JSON Reference spec or as part of the JSON Schema Core spec, states that keywords adjacent to "$ref" MUST be ignored. Therefore these tests were invalid, even though the intent was clear to most readers. The correct way to combine "$ref"s is with "allOf".
1 parent 9567c58 commit b110f8d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

tests/draft3/ref.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"b": {"$ref": "#/definitions/a"},
126126
"c": {"$ref": "#/definitions/b"}
127127
},
128-
"$ref": "#/definitions/c"
128+
"allOf": [{"$ref": "#/definitions/c"}]
129129
},
130130
"tests": [
131131
{
@@ -150,7 +150,7 @@
150150
},
151151
"properties": {
152152
"foo": {
153-
"$ref": "#/definitions/reffed",
153+
"allOf": [{"$ref": "#/definitions/reffed"}],
154154
"maxItems": 2
155155
}
156156
}

tests/draft4/ref.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"b": {"$ref": "#/definitions/a"},
126126
"c": {"$ref": "#/definitions/b"}
127127
},
128-
"$ref": "#/definitions/c"
128+
"allOf": [{"$ref": "#/definitions/c"}]
129129
},
130130
"tests": [
131131
{
@@ -150,7 +150,7 @@
150150
},
151151
"properties": {
152152
"foo": {
153-
"$ref": "#/definitions/reffed",
153+
"allOf": [{"$ref": "#/definitions/reffed"}],
154154
"maxItems": 2
155155
}
156156
}

tests/draft6/ref.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"b": {"$ref": "#/definitions/a"},
126126
"c": {"$ref": "#/definitions/b"}
127127
},
128-
"$ref": "#/definitions/c"
128+
"allOf": [{"$ref": "#/definitions/c"}]
129129
},
130130
"tests": [
131131
{
@@ -150,7 +150,7 @@
150150
},
151151
"properties": {
152152
"foo": {
153-
"$ref": "#/definitions/reffed",
153+
"allOf": [{"$ref": "#/definitions/reffed"}],
154154
"maxItems": 2
155155
}
156156
}
@@ -212,7 +212,7 @@
212212
{
213213
"description": "$ref to boolean schema true",
214214
"schema": {
215-
"$ref": "#/definitions/bool",
215+
"allOf": [{"$ref": "#/definitions/bool"}],
216216
"definitions": {
217217
"bool": true
218218
}
@@ -228,7 +228,7 @@
228228
{
229229
"description": "$ref to boolean schema false",
230230
"schema": {
231-
"$ref": "#/definitions/bool",
231+
"allOf": [{"$ref": "#/definitions/bool"}],
232232
"definitions": {
233233
"bool": false
234234
}

0 commit comments

Comments
 (0)