Skip to content

Commit 0b70079

Browse files
committed
Squashed 'json/' changes from e68ff511..812ba486
812ba486 definitions -> $defs f45b7298 Merge remote-tracking branch 'alvarogzp/location-independent-identifiers-tests' 118a0fe5 Add location-independent identifier tests to draft2019-06 folder b95ce749 Merge remote-tracking branch 'upstream/master' into location-independent-identifiers-tests 038d7e77 Rename test to avoid misusing the 'canonical' word c98ffc39 Remove one wrong testcase and put every $ref in an allOf. d4d30f1c Add tests for location-independent identifiers git-subtree-dir: json git-subtree-split: 812ba4861bc3f892f3e6544a31923d883d8024e2
1 parent cf09b91 commit 0b70079

File tree

4 files changed

+336
-0
lines changed

4 files changed

+336
-0
lines changed

tests/draft2019-06/ref.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,89 @@
355355
"valid": false
356356
}
357357
]
358+
},
359+
{
360+
"description": "Location-independent identifier",
361+
"schema": {
362+
"allOf": [{
363+
"$ref": "#foo"
364+
}],
365+
"$defs": {
366+
"A": {
367+
"$id": "#foo",
368+
"type": "integer"
369+
}
370+
}
371+
},
372+
"tests": [
373+
{
374+
"data": 1,
375+
"description": "match",
376+
"valid": true
377+
},
378+
{
379+
"data": "a",
380+
"description": "mismatch",
381+
"valid": false
382+
}
383+
]
384+
},
385+
{
386+
"description": "Location-independent identifier with absolute URI",
387+
"schema": {
388+
"allOf": [{
389+
"$ref": "http://localhost:1234/bar#foo"
390+
}],
391+
"$defs": {
392+
"A": {
393+
"$id": "http://localhost:1234/bar#foo",
394+
"type": "integer"
395+
}
396+
}
397+
},
398+
"tests": [
399+
{
400+
"data": 1,
401+
"description": "match",
402+
"valid": true
403+
},
404+
{
405+
"data": "a",
406+
"description": "mismatch",
407+
"valid": false
408+
}
409+
]
410+
},
411+
{
412+
"description": "Location-independent identifier with base URI change in subschema",
413+
"schema": {
414+
"$id": "http://localhost:1234/root",
415+
"allOf": [{
416+
"$ref": "http://localhost:1234/nested.json#foo"
417+
}],
418+
"$defs": {
419+
"A": {
420+
"$id": "nested.json",
421+
"$defs": {
422+
"B": {
423+
"$id": "#foo",
424+
"type": "integer"
425+
}
426+
}
427+
}
428+
}
429+
},
430+
"tests": [
431+
{
432+
"data": 1,
433+
"description": "match",
434+
"valid": true
435+
},
436+
{
437+
"data": "a",
438+
"description": "mismatch",
439+
"valid": false
440+
}
441+
]
358442
}
359443
]

tests/draft4/ref.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,5 +323,89 @@
323323
"valid": false
324324
}
325325
]
326+
},
327+
{
328+
"description": "Location-independent identifier",
329+
"schema": {
330+
"allOf": [{
331+
"$ref": "#foo"
332+
}],
333+
"definitions": {
334+
"A": {
335+
"id": "#foo",
336+
"type": "integer"
337+
}
338+
}
339+
},
340+
"tests": [
341+
{
342+
"data": 1,
343+
"description": "match",
344+
"valid": true
345+
},
346+
{
347+
"data": "a",
348+
"description": "mismatch",
349+
"valid": false
350+
}
351+
]
352+
},
353+
{
354+
"description": "Location-independent identifier with absolute URI",
355+
"schema": {
356+
"allOf": [{
357+
"$ref": "http://localhost:1234/bar#foo"
358+
}],
359+
"definitions": {
360+
"A": {
361+
"id": "http://localhost:1234/bar#foo",
362+
"type": "integer"
363+
}
364+
}
365+
},
366+
"tests": [
367+
{
368+
"data": 1,
369+
"description": "match",
370+
"valid": true
371+
},
372+
{
373+
"data": "a",
374+
"description": "mismatch",
375+
"valid": false
376+
}
377+
]
378+
},
379+
{
380+
"description": "Location-independent identifier with base URI change in subschema",
381+
"schema": {
382+
"id": "http://localhost:1234/root",
383+
"allOf": [{
384+
"$ref": "http://localhost:1234/nested.json#foo"
385+
}],
386+
"definitions": {
387+
"A": {
388+
"id": "nested.json",
389+
"definitions": {
390+
"B": {
391+
"id": "#foo",
392+
"type": "integer"
393+
}
394+
}
395+
}
396+
}
397+
},
398+
"tests": [
399+
{
400+
"data": 1,
401+
"description": "match",
402+
"valid": true
403+
},
404+
{
405+
"data": "a",
406+
"description": "mismatch",
407+
"valid": false
408+
}
409+
]
326410
}
327411
]

tests/draft6/ref.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,89 @@
355355
"valid": false
356356
}
357357
]
358+
},
359+
{
360+
"description": "Location-independent identifier",
361+
"schema": {
362+
"allOf": [{
363+
"$ref": "#foo"
364+
}],
365+
"definitions": {
366+
"A": {
367+
"$id": "#foo",
368+
"type": "integer"
369+
}
370+
}
371+
},
372+
"tests": [
373+
{
374+
"data": 1,
375+
"description": "match",
376+
"valid": true
377+
},
378+
{
379+
"data": "a",
380+
"description": "mismatch",
381+
"valid": false
382+
}
383+
]
384+
},
385+
{
386+
"description": "Location-independent identifier with absolute URI",
387+
"schema": {
388+
"allOf": [{
389+
"$ref": "http://localhost:1234/bar#foo"
390+
}],
391+
"definitions": {
392+
"A": {
393+
"$id": "http://localhost:1234/bar#foo",
394+
"type": "integer"
395+
}
396+
}
397+
},
398+
"tests": [
399+
{
400+
"data": 1,
401+
"description": "match",
402+
"valid": true
403+
},
404+
{
405+
"data": "a",
406+
"description": "mismatch",
407+
"valid": false
408+
}
409+
]
410+
},
411+
{
412+
"description": "Location-independent identifier with base URI change in subschema",
413+
"schema": {
414+
"$id": "http://localhost:1234/root",
415+
"allOf": [{
416+
"$ref": "http://localhost:1234/nested.json#foo"
417+
}],
418+
"definitions": {
419+
"A": {
420+
"$id": "nested.json",
421+
"definitions": {
422+
"B": {
423+
"$id": "#foo",
424+
"type": "integer"
425+
}
426+
}
427+
}
428+
}
429+
},
430+
"tests": [
431+
{
432+
"data": 1,
433+
"description": "match",
434+
"valid": true
435+
},
436+
{
437+
"data": "a",
438+
"description": "mismatch",
439+
"valid": false
440+
}
441+
]
358442
}
359443
]

tests/draft7/ref.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,89 @@
355355
"valid": false
356356
}
357357
]
358+
},
359+
{
360+
"description": "Location-independent identifier",
361+
"schema": {
362+
"allOf": [{
363+
"$ref": "#foo"
364+
}],
365+
"definitions": {
366+
"A": {
367+
"$id": "#foo",
368+
"type": "integer"
369+
}
370+
}
371+
},
372+
"tests": [
373+
{
374+
"data": 1,
375+
"description": "match",
376+
"valid": true
377+
},
378+
{
379+
"data": "a",
380+
"description": "mismatch",
381+
"valid": false
382+
}
383+
]
384+
},
385+
{
386+
"description": "Location-independent identifier with absolute URI",
387+
"schema": {
388+
"allOf": [{
389+
"$ref": "http://localhost:1234/bar#foo"
390+
}],
391+
"definitions": {
392+
"A": {
393+
"$id": "http://localhost:1234/bar#foo",
394+
"type": "integer"
395+
}
396+
}
397+
},
398+
"tests": [
399+
{
400+
"data": 1,
401+
"description": "match",
402+
"valid": true
403+
},
404+
{
405+
"data": "a",
406+
"description": "mismatch",
407+
"valid": false
408+
}
409+
]
410+
},
411+
{
412+
"description": "Location-independent identifier with base URI change in subschema",
413+
"schema": {
414+
"$id": "http://localhost:1234/root",
415+
"allOf": [{
416+
"$ref": "http://localhost:1234/nested.json#foo"
417+
}],
418+
"definitions": {
419+
"A": {
420+
"$id": "nested.json",
421+
"definitions": {
422+
"B": {
423+
"$id": "#foo",
424+
"type": "integer"
425+
}
426+
}
427+
}
428+
}
429+
},
430+
"tests": [
431+
{
432+
"data": 1,
433+
"description": "match",
434+
"valid": true
435+
},
436+
{
437+
"data": "a",
438+
"description": "mismatch",
439+
"valid": false
440+
}
441+
]
358442
}
359443
]

0 commit comments

Comments
 (0)