File tree 7 files changed +186
-1
lines changed
7 files changed +186
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,28 @@ REMOTES = {
51
51
u"refToInteger" : {u"$ref" : u"#/$defs/integer" },
52
52
}
53
53
},
54
+ "subSchemas-ids.json" : {
55
+ u"$id" : u"http://localhost:1234/subSchemas-ids.json" ,
56
+ u"allOf" : [
57
+ {u"$ref" : u"#/$defs/referencing" }
58
+ ],
59
+ u"$defs" : {
60
+ u"referencing" : {
61
+ u"$id" : u"referencing.json" ,
62
+ u"allOf" : [
63
+ {u"$ref" : u"#/$defs/referenced" }
64
+ ],
65
+ u"$defs" : {
66
+ u"referenced" : {
67
+ u"enum" : [u"should-be-valid" ]
68
+ }
69
+ }
70
+ },
71
+ u"referenced" : {
72
+ u"enum" : [u"should-NOT-be-valid" ]
73
+ }
74
+ }
75
+ },
54
76
"folder/folderInteger.json" : {u"type" : u"integer" }
55
77
}
56
78
REMOTES_DIR = os .path .join (ROOT_DIR , "remotes" )
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ const refs = {
8
8
'http://localhost:1234/subSchemas.json' : require ( './remotes/subSchemas.json' ) ,
9
9
'http://localhost:1234/folder/folderInteger.json' : require ( './remotes/folder/folderInteger.json' ) ,
10
10
'http://localhost:1234/name.json' : require ( './remotes/name.json' ) ,
11
- 'http://localhost:1234/name-defs.json' : require ( './remotes/name-defs.json' )
11
+ 'http://localhost:1234/name-defs.json' : require ( './remotes/name-defs.json' ) ,
12
+ 'http://localhost:1234/subSchemas-ids.json' : require ( './remotes/subSchemas-ids.json' )
12
13
} ;
13
14
14
15
const SKIP = {
Original file line number Diff line number Diff line change
1
+ {
2
+ "$id" : " http://localhost:1234/subSchemas-ids.json" ,
3
+ "allOf" : [
4
+ {"$ref" : " #/$defs/referencing" }
5
+ ],
6
+ "$defs" : {
7
+ "referencing" : {
8
+ "$id" : " referencing.json" ,
9
+ "allOf" : [
10
+ {"$ref" : " #/$defs/referenced" }
11
+ ],
12
+ "$defs" : {
13
+ "referenced" : {
14
+ "enum" : [" should-be-valid" ]
15
+ }
16
+ }
17
+ },
18
+ "referenced" : {
19
+ "enum" : [" should-NOT-be-valid" ]
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change 382
382
"valid" : false
383
383
}
384
384
]
385
+ },
386
+ {
387
+ "description" : " $ref uses base URI learned from $id" ,
388
+ "schema" : {
389
+ "allOf" : [
390
+ {"$ref" : " #/$defs/referencing" }
391
+ ],
392
+ "$defs" : {
393
+ "referencing" : {
394
+ "$id" : " /referencing.json" ,
395
+ "$comment" : " The $id here changes the base URI that $ref's value is resolved against" ,
396
+ "allOf" : [
397
+ {"$ref" : " #/$defs/referenced" }
398
+ ],
399
+ "$defs" : {
400
+ "referenced" : {
401
+ "$comment" : " This schema IS being referenced" ,
402
+ "enum" : [" should-be-valid" ]
403
+ }
404
+ }
405
+ },
406
+ "referenced" : {
407
+ "$comment" : " This schema is NOT being referenced" ,
408
+ "enum" : [" should-NOT-be-valid" ]
409
+ }
410
+ }
411
+ },
412
+ "tests" : [
413
+ {
414
+ "description" : " the correct schema is referenced" ,
415
+ "data" : " should-be-valid" ,
416
+ "valid" : true
417
+ },
418
+ {
419
+ "description" : " the incorrect schema is not referenced" ,
420
+ "data" : " should-NOT-be-valid" ,
421
+ "valid" : false
422
+ },
423
+ {
424
+ "description" : " sanity check that other invalid values aren't accepted either" ,
425
+ "data" : " bogus" ,
426
+ "valid" : false
427
+ }
428
+ ]
385
429
}
386
430
]
Original file line number Diff line number Diff line change 163
163
"valid" : false
164
164
}
165
165
]
166
+ },
167
+ {
168
+ "description" : " $ref uses base URI learned from $id in remote schemas" ,
169
+ "schema" : {
170
+ "$id" : " http://localhost:1234/" ,
171
+ "allOf" : [
172
+ {"$ref" : " subSchemas-ids.json" }
173
+ ]
174
+ },
175
+ "tests" : [
176
+ {
177
+ "description" : " the correct schema is referenced" ,
178
+ "data" : " should-be-valid" ,
179
+ "valid" : true
180
+ },
181
+ {
182
+ "description" : " the incorrect schema is not referenced" ,
183
+ "data" : " should-NOT-be-valid" ,
184
+ "valid" : false
185
+ },
186
+ {
187
+ "description" : " sanity check that other invalid values aren't accepted either" ,
188
+ "data" : " bogus" ,
189
+ "valid" : false
190
+ }
191
+ ]
166
192
}
167
193
]
Original file line number Diff line number Diff line change 439
439
"valid" : false
440
440
}
441
441
]
442
+ },
443
+ {
444
+ "description" : " $ref uses base URI learned from $id" ,
445
+ "schema" : {
446
+ "allOf" : [
447
+ {"$ref" : " #/$defs/referencing" }
448
+ ],
449
+ "$defs" : {
450
+ "referencing" : {
451
+ "$id" : " /referencing.json" ,
452
+ "$comment" : " The $id here changes the base URI that $ref's value is resolved against" ,
453
+ "allOf" : [
454
+ {"$ref" : " #/$defs/referenced" }
455
+ ],
456
+ "$defs" : {
457
+ "referenced" : {
458
+ "$comment" : " This schema IS being referenced" ,
459
+ "enum" : [" should-be-valid" ]
460
+ }
461
+ }
462
+ },
463
+ "referenced" : {
464
+ "$comment" : " This schema is NOT being referenced" ,
465
+ "enum" : [" should-NOT-be-valid" ]
466
+ }
467
+ }
468
+ },
469
+ "tests" : [
470
+ {
471
+ "description" : " the correct schema is referenced" ,
472
+ "data" : " should-be-valid" ,
473
+ "valid" : true
474
+ },
475
+ {
476
+ "description" : " the incorrect schema is not referenced" ,
477
+ "data" : " should-NOT-be-valid" ,
478
+ "valid" : false
479
+ },
480
+ {
481
+ "description" : " sanity check that other invalid values aren't accepted either" ,
482
+ "data" : " bogus" ,
483
+ "valid" : false
484
+ }
485
+ ]
442
486
}
443
487
]
Original file line number Diff line number Diff line change 167
167
"valid" : false
168
168
}
169
169
]
170
+ },
171
+ {
172
+ "description" : " $ref uses base URI learned from $id in remote schemas" ,
173
+ "schema" : {
174
+ "$id" : " http://localhost:1234/" ,
175
+ "allOf" : [
176
+ {"$ref" : " subSchemas-ids.json" }
177
+ ]
178
+ },
179
+ "tests" : [
180
+ {
181
+ "description" : " the correct schema is referenced" ,
182
+ "data" : " should-be-valid" ,
183
+ "valid" : true
184
+ },
185
+ {
186
+ "description" : " the incorrect schema is not referenced" ,
187
+ "data" : " should-NOT-be-valid" ,
188
+ "valid" : false
189
+ },
190
+ {
191
+ "description" : " sanity check that other invalid values aren't accepted either" ,
192
+ "data" : " bogus" ,
193
+ "valid" : false
194
+ }
195
+ ]
170
196
}
171
197
]
You can’t perform that action at this time.
0 commit comments