Skip to content

Commit c911798

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". These tests have probably generally worked b/c "definitions" is usually processed up front.
1 parent 9567c58 commit c911798

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

tests/draft3/ref.json

+1-1
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
{

tests/draft4/ref.json

+1-1
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
{

tests/draft6/ref.json

+3-3
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
{
@@ -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)