Skip to content

Commit fd9bcfb

Browse files
authored
Merge pull request #421 from willson-chen/bug601_addtestcase
subschema nested ref in remote ref
2 parents 69acf52 + 13685a6 commit fd9bcfb

File tree

7 files changed

+134
-0
lines changed

7 files changed

+134
-0
lines changed

remotes/nested/foo-ref-string.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"foo": {"$ref": "string.json"}
5+
}
6+
}

remotes/nested/string.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "string"
3+
}

tests/draft-next/refRemote.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,30 @@
204204
"valid": false
205205
}
206206
]
207+
},
208+
{
209+
"description": "retrieved nested refs resolve relative to their URI not $id",
210+
"schema": {
211+
"$id": "http://localhost:1234/some-id",
212+
"properties": {
213+
"name": {"$ref": "nested/foo-ref-string.json"}
214+
}
215+
},
216+
"tests": [
217+
{
218+
"description": "number is invalid",
219+
"data": {
220+
"name": {"foo": 1}
221+
},
222+
"valid": false
223+
},
224+
{
225+
"description": "string is valid",
226+
"data": {
227+
"name": {"foo": "a"}
228+
},
229+
"valid": true
230+
}
231+
]
207232
}
208233
]

tests/draft2019-09/refRemote.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,30 @@
204204
"valid": false
205205
}
206206
]
207+
},
208+
{
209+
"description": "retrieved nested refs resolve relative to their URI not $id",
210+
"schema": {
211+
"$id": "http://localhost:1234/some-id",
212+
"properties": {
213+
"name": {"$ref": "nested/foo-ref-string.json"}
214+
}
215+
},
216+
"tests": [
217+
{
218+
"description": "number is invalid",
219+
"data": {
220+
"name": {"foo": 1}
221+
},
222+
"valid": false
223+
},
224+
{
225+
"description": "string is valid",
226+
"data": {
227+
"name": {"foo": "a"}
228+
},
229+
"valid": true
230+
}
231+
]
207232
}
208233
]

tests/draft2020-12/refRemote.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,30 @@
204204
"valid": false
205205
}
206206
]
207+
},
208+
{
209+
"description": "retrieved nested refs resolve relative to their URI not $id",
210+
"schema": {
211+
"$id": "http://localhost:1234/some-id",
212+
"properties": {
213+
"name": {"$ref": "nested/foo-ref-string.json"}
214+
}
215+
},
216+
"tests": [
217+
{
218+
"description": "number is invalid",
219+
"data": {
220+
"name": {"foo": 1}
221+
},
222+
"valid": false
223+
},
224+
{
225+
"description": "string is valid",
226+
"data": {
227+
"name": {"foo": "a"}
228+
},
229+
"valid": true
230+
}
231+
]
207232
}
208233
]

tests/draft6/refRemote.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,30 @@
210210
"valid": false
211211
}
212212
]
213+
},
214+
{
215+
"description": "retrieved nested refs resolve relative to their URI not $id",
216+
"schema": {
217+
"$id": "http://localhost:1234/some-id",
218+
"properties": {
219+
"name": {"$ref": "nested/foo-ref-string.json"}
220+
}
221+
},
222+
"tests": [
223+
{
224+
"description": "number is invalid",
225+
"data": {
226+
"name": {"foo": 1}
227+
},
228+
"valid": false
229+
},
230+
{
231+
"description": "string is valid",
232+
"data": {
233+
"name": {"foo": "a"}
234+
},
235+
"valid": true
236+
}
237+
]
213238
}
214239
]

tests/draft7/refRemote.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,30 @@
210210
"valid": false
211211
}
212212
]
213+
},
214+
{
215+
"description": "retrieved nested refs resolve relative to their URI not $id",
216+
"schema": {
217+
"$id": "http://localhost:1234/some-id",
218+
"properties": {
219+
"name": {"$ref": "nested/foo-ref-string.json"}
220+
}
221+
},
222+
"tests": [
223+
{
224+
"description": "number is invalid",
225+
"data": {
226+
"name": {"foo": 1}
227+
},
228+
"valid": false
229+
},
230+
{
231+
"description": "string is valid",
232+
"data": {
233+
"name": {"foo": "a"}
234+
},
235+
"valid": true
236+
}
237+
]
213238
}
214239
]

0 commit comments

Comments
 (0)