Skip to content

Commit d0a2d44

Browse files
committed
Merge commit '4e76fb6ae3c1f77d12bca82e4f92691dd57cac15'
* commit '4e76fb6ae3c1f77d12bca82e4f92691dd57cac15': Squashed 'json/' changes from 0aefbb3d..1326f36e
2 parents 35d38bb + 4e76fb6 commit d0a2d44

File tree

6 files changed

+150
-2
lines changed

6 files changed

+150
-2
lines changed

json/tests/draft3/ref.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,42 @@
200200
}
201201
]
202202
},
203+
{
204+
"description": "$ref prevents a sibling $id from changing the base uri",
205+
"schema": {
206+
"$id": "http://localhost:1234/sibling_id/base/",
207+
"definitions": {
208+
"foo": {
209+
"$id": "http://localhost:1234/sibling_id/foo.json",
210+
"minimum": 2
211+
},
212+
"base_foo": {
213+
"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
214+
"$id": "foo.json",
215+
"minimum": 5
216+
}
217+
},
218+
"allOf": [
219+
{
220+
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json",
221+
"$id": "http://localhost:1234/sibling_id/",
222+
"$ref": "foo.json"
223+
}
224+
]
225+
},
226+
"tests": [
227+
{
228+
"description": "$ref resolves to /definitions/foo, data validates",
229+
"data": 10,
230+
"valid": true
231+
},
232+
{
233+
"description": "$ref resolves to /definitions/foo, data does not validate",
234+
"data": 1,
235+
"valid": false
236+
}
237+
]
238+
},
203239
{
204240
"description": "remote ref, containing refs itself",
205241
"schema": {"$ref": "http://json-schema.org/draft-03/schema#"},

json/tests/draft4/ref.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,42 @@
175175
}
176176
]
177177
},
178+
{
179+
"description": "$ref prevents a sibling $id from changing the base uri",
180+
"schema": {
181+
"$id": "http://localhost:1234/sibling_id/base/",
182+
"definitions": {
183+
"foo": {
184+
"$id": "http://localhost:1234/sibling_id/foo.json",
185+
"minimum": 2
186+
},
187+
"base_foo": {
188+
"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
189+
"$id": "foo.json",
190+
"minimum": 5
191+
}
192+
},
193+
"allOf": [
194+
{
195+
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json",
196+
"$id": "http://localhost:1234/sibling_id/",
197+
"$ref": "foo.json"
198+
}
199+
]
200+
},
201+
"tests": [
202+
{
203+
"description": "$ref resolves to /definitions/foo, data validates",
204+
"data": 10,
205+
"valid": true
206+
},
207+
{
208+
"description": "$ref resolves to /definitions/foo, data does not validate",
209+
"data": 1,
210+
"valid": false
211+
}
212+
]
213+
},
178214
{
179215
"description": "remote ref, containing refs itself",
180216
"schema": {"$ref": "http://json-schema.org/draft-04/schema#"},

json/tests/draft6/ref.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,42 @@
175175
}
176176
]
177177
},
178+
{
179+
"description": "$ref prevents a sibling $id from changing the base uri",
180+
"schema": {
181+
"$id": "http://localhost:1234/sibling_id/base/",
182+
"definitions": {
183+
"foo": {
184+
"$id": "http://localhost:1234/sibling_id/foo.json",
185+
"minimum": 2
186+
},
187+
"base_foo": {
188+
"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
189+
"$id": "foo.json",
190+
"minimum": 5
191+
}
192+
},
193+
"allOf": [
194+
{
195+
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json",
196+
"$id": "http://localhost:1234/sibling_id/",
197+
"$ref": "foo.json"
198+
}
199+
]
200+
},
201+
"tests": [
202+
{
203+
"description": "$ref resolves to /definitions/foo, data validates",
204+
"data": 10,
205+
"valid": true
206+
},
207+
{
208+
"description": "$ref resolves to /definitions/foo, data does not validate",
209+
"data": 1,
210+
"valid": false
211+
}
212+
]
213+
},
178214
{
179215
"description": "remote ref, containing refs itself",
180216
"schema": {"$ref": "http://json-schema.org/draft-06/schema#"},

json/tests/draft6/refRemote.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@
172172
"description": "remote ref with ref to definitions",
173173
"schema": {
174174
"$id": "http://localhost:1234/schema-remote-ref-ref-defs1.json",
175-
"$ref": "ref-and-definitions.json"
175+
"allOf": [
176+
{ "$ref": "ref-and-definitions.json" }
177+
]
176178
},
177179
"tests": [
178180
{

json/tests/draft7/ref.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,42 @@
175175
}
176176
]
177177
},
178+
{
179+
"description": "$ref prevents a sibling $id from changing the base uri",
180+
"schema": {
181+
"$id": "http://localhost:1234/sibling_id/base/",
182+
"definitions": {
183+
"foo": {
184+
"$id": "http://localhost:1234/sibling_id/foo.json",
185+
"minimum": 2
186+
},
187+
"base_foo": {
188+
"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
189+
"$id": "foo.json",
190+
"minimum": 5
191+
}
192+
},
193+
"allOf": [
194+
{
195+
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json",
196+
"$id": "http://localhost:1234/sibling_id/",
197+
"$ref": "foo.json"
198+
}
199+
]
200+
},
201+
"tests": [
202+
{
203+
"description": "$ref resolves to /definitions/foo, data validates",
204+
"data": 10,
205+
"valid": true
206+
},
207+
{
208+
"description": "$ref resolves to /definitions/foo, data does not validate",
209+
"data": 1,
210+
"valid": false
211+
}
212+
]
213+
},
178214
{
179215
"description": "remote ref, containing refs itself",
180216
"schema": {"$ref": "http://json-schema.org/draft-07/schema#"},

json/tests/draft7/refRemote.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@
172172
"description": "remote ref with ref to definitions",
173173
"schema": {
174174
"$id": "http://localhost:1234/schema-remote-ref-ref-defs1.json",
175-
"$ref": "ref-and-definitions.json"
175+
"allOf": [
176+
{ "$ref": "ref-and-definitions.json" }
177+
]
176178
},
177179
"tests": [
178180
{

0 commit comments

Comments
 (0)