Skip to content

Commit d595dbf

Browse files
committed
backport $ref cases, changing "$defs" to "definitions"
1 parent 452b5f8 commit d595dbf

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

tests/draft3/ref.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,31 @@
173173
}
174174
]
175175
},
176+
{
177+
"description": "property named $ref, containing an actual $ref",
178+
"schema": {
179+
"properties": {
180+
"$ref": {"$ref": "#/definitions/is-string"}
181+
},
182+
"definitions": {
183+
"is-string": {
184+
"type": "string"
185+
}
186+
}
187+
},
188+
"tests": [
189+
{
190+
"description": "property named $ref valid",
191+
"data": {"$ref": "a"},
192+
"valid": true
193+
},
194+
{
195+
"description": "property named $ref invalid",
196+
"data": {"$ref": 2},
197+
"valid": false
198+
}
199+
]
200+
},
176201
{
177202
"description": "remote ref, containing refs itself",
178203
"schema": {"$ref": "http://json-schema.org/draft-03/schema#"},

tests/draft4/ref.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,31 @@
209209
}
210210
]
211211
},
212+
{
213+
"description": "property named $ref, containing an actual $ref",
214+
"schema": {
215+
"properties": {
216+
"$ref": {"$ref": "#/definitions/is-string"}
217+
},
218+
"definitions": {
219+
"is-string": {
220+
"type": "string"
221+
}
222+
}
223+
},
224+
"tests": [
225+
{
226+
"description": "property named $ref valid",
227+
"data": {"$ref": "a"},
228+
"valid": true
229+
},
230+
{
231+
"description": "property named $ref invalid",
232+
"data": {"$ref": 2},
233+
"valid": false
234+
}
235+
]
236+
},
212237
{
213238
"description": "Recursive references between schemas",
214239
"schema": {

tests/draft6/ref.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,31 @@
209209
}
210210
]
211211
},
212+
{
213+
"description": "property named $ref, containing an actual $ref",
214+
"schema": {
215+
"properties": {
216+
"$ref": {"$ref": "#/definitions/is-string"}
217+
},
218+
"definitions": {
219+
"is-string": {
220+
"type": "string"
221+
}
222+
}
223+
},
224+
"tests": [
225+
{
226+
"description": "property named $ref valid",
227+
"data": {"$ref": "a"},
228+
"valid": true
229+
},
230+
{
231+
"description": "property named $ref invalid",
232+
"data": {"$ref": 2},
233+
"valid": false
234+
}
235+
]
236+
},
212237
{
213238
"description": "$ref to boolean schema true",
214239
"schema": {

tests/draft7/ref.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,31 @@
209209
}
210210
]
211211
},
212+
{
213+
"description": "property named $ref, containing an actual $ref",
214+
"schema": {
215+
"properties": {
216+
"$ref": {"$ref": "#/definitions/is-string"}
217+
},
218+
"definitions": {
219+
"is-string": {
220+
"type": "string"
221+
}
222+
}
223+
},
224+
"tests": [
225+
{
226+
"description": "property named $ref valid",
227+
"data": {"$ref": "a"},
228+
"valid": true
229+
},
230+
{
231+
"description": "property named $ref invalid",
232+
"data": {"$ref": 2},
233+
"valid": false
234+
}
235+
]
236+
},
212237
{
213238
"description": "$ref to boolean schema true",
214239
"schema": {

0 commit comments

Comments
 (0)