File tree Expand file tree Collapse file tree 5 files changed +163
-1
lines changed Expand file tree Collapse file tree 5 files changed +163
-1
lines changed 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 1055
1055
"valid" : false
1056
1056
}
1057
1057
]
1058
- }
1058
+ },
1059
+ {
1060
+ "description" : " $ref uses base URI learned from $id" ,
1061
+ "schema" : {
1062
+ "allOf" : [
1063
+ {"$ref" : " #/$defs/referencing" }
1064
+ ],
1065
+ "$defs" : {
1066
+ "referencing" : {
1067
+ "$id" : " /referencing.json" ,
1068
+ "$comment" : " The $id here changes the base URI that $ref's value is resolved against" ,
1069
+ "allOf" : [
1070
+ {"$ref" : " #/$defs/referenced" }
1071
+ ],
1072
+ "$defs" : {
1073
+ "referenced" : {
1074
+ "$comment" : " This schema IS being referenced" ,
1075
+ "enum" : [" should-be-valid" ]
1076
+ }
1077
+ }
1078
+ },
1079
+ "referenced" : {
1080
+ "$comment" : " This schema is NOT being referenced" ,
1081
+ "enum" : [" should-NOT-be-valid" ]
1082
+ }
1083
+ }
1084
+ },
1085
+ "tests" : [
1086
+ {
1087
+ "description" : " the correct schema is referenced" ,
1088
+ "data" : " should-be-valid" ,
1089
+ "valid" : true
1090
+ },
1091
+ {
1092
+ "description" : " the incorrect schema is not referenced" ,
1093
+ "data" : " should-NOT-be-valid" ,
1094
+ "valid" : false
1095
+ },
1096
+ {
1097
+ "description" : " sanity check that other invalid values aren't accepted either" ,
1098
+ "data" : " bogus" ,
1099
+ "valid" : false
1100
+ }
1101
+ ]
1102
+ }
1059
1103
]
Original file line number Diff line number Diff line change 310
310
"valid" : true
311
311
}
312
312
]
313
+ },
314
+ {
315
+ "description" : " $ref uses base URI learned from $id in remote schemas" ,
316
+ "schema" : {
317
+ "$id" : " http://localhost:1234/" ,
318
+ "allOf" : [
319
+ {"$ref" : " subSchemas-ids.json" }
320
+ ]
321
+ },
322
+ "tests" : [
323
+ {
324
+ "description" : " the correct schema is referenced" ,
325
+ "data" : " should-be-valid" ,
326
+ "valid" : true
327
+ },
328
+ {
329
+ "description" : " the incorrect schema is not referenced" ,
330
+ "data" : " should-NOT-be-valid" ,
331
+ "valid" : false
332
+ },
333
+ {
334
+ "description" : " sanity check that other invalid values aren't accepted either" ,
335
+ "data" : " bogus" ,
336
+ "valid" : false
337
+ }
338
+ ]
313
339
}
314
340
]
Original file line number Diff line number Diff line change 1012
1012
"valid" : false
1013
1013
}
1014
1014
]
1015
+ },
1016
+ {
1017
+ "description" : " $ref uses base URI learned from $id" ,
1018
+ "schema" : {
1019
+ "allOf" : [
1020
+ {"$ref" : " #/$defs/referencing" }
1021
+ ],
1022
+ "$defs" : {
1023
+ "referencing" : {
1024
+ "$id" : " /referencing.json" ,
1025
+ "$comment" : " The $id here changes the base URI that $ref's value is resolved against" ,
1026
+ "allOf" : [
1027
+ {"$ref" : " #/$defs/referenced" }
1028
+ ],
1029
+ "$defs" : {
1030
+ "referenced" : {
1031
+ "$comment" : " This schema IS being referenced" ,
1032
+ "enum" : [" should-be-valid" ]
1033
+ }
1034
+ }
1035
+ },
1036
+ "referenced" : {
1037
+ "$comment" : " This schema is NOT being referenced" ,
1038
+ "enum" : [" should-NOT-be-valid" ]
1039
+ }
1040
+ }
1041
+ },
1042
+ "tests" : [
1043
+ {
1044
+ "description" : " the correct schema is referenced" ,
1045
+ "data" : " should-be-valid" ,
1046
+ "valid" : true
1047
+ },
1048
+ {
1049
+ "description" : " the incorrect schema is not referenced" ,
1050
+ "data" : " should-NOT-be-valid" ,
1051
+ "valid" : false
1052
+ },
1053
+ {
1054
+ "description" : " sanity check that other invalid values aren't accepted either" ,
1055
+ "data" : " bogus" ,
1056
+ "valid" : false
1057
+ }
1058
+ ]
1015
1059
}
1016
1060
]
Original file line number Diff line number Diff line change 235
235
"valid" : true
236
236
}
237
237
]
238
+ },
239
+ {
240
+ "description" : " $ref uses base URI learned from $id in remote schemas" ,
241
+ "schema" : {
242
+ "$id" : " http://localhost:1234/" ,
243
+ "allOf" : [
244
+ {"$ref" : " subSchemas-ids.json" }
245
+ ]
246
+ },
247
+ "tests" : [
248
+ {
249
+ "description" : " the correct schema is referenced" ,
250
+ "data" : " should-be-valid" ,
251
+ "valid" : true
252
+ },
253
+ {
254
+ "description" : " the incorrect schema is not referenced" ,
255
+ "data" : " should-NOT-be-valid" ,
256
+ "valid" : false
257
+ },
258
+ {
259
+ "description" : " sanity check that other invalid values aren't accepted either" ,
260
+ "data" : " bogus" ,
261
+ "valid" : false
262
+ }
263
+ ]
238
264
}
239
265
]
You can’t perform that action at this time.
0 commit comments