@@ -236,15 +236,9 @@ TEST(SchemaValidator, AllOf) {
236
236
237
237
VALIDATE (s, " \" ok\" " , true );
238
238
INVALIDATE (s, " \" too long\" " , " " , " allOf" , " " ,
239
- " { \" allOf\" : {"
240
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
241
- " \" errors\" : ["
242
- " {},"
243
- " { \" maxLength\" : { "
244
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/1\" , "
245
- " \" expected\" : 5, \" actual\" : \" too long\" "
246
- " }}"
247
- " ]"
239
+ " { \" maxLength\" : { "
240
+ " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/1\" , "
241
+ " \" expected\" : 5, \" actual\" : \" too long\" "
248
242
" }}" );
249
243
}
250
244
{
@@ -254,14 +248,8 @@ TEST(SchemaValidator, AllOf) {
254
248
255
249
VALIDATE (s, " \" No way\" " , false );
256
250
INVALIDATE (s, " -1" , " " , " allOf" , " " ,
257
- " { \" allOf\" : {"
258
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
259
- " \" errors\" : ["
260
- " { \" type\" : { \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
261
- " \" expected\" : [\" string\" ], \" actual\" : \" integer\" "
262
- " }},"
263
- " {}"
264
- " ]"
251
+ " { \" type\" : { \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
252
+ " \" expected\" : [\" string\" ], \" actual\" : \" integer\" "
265
253
" }}" );
266
254
}
267
255
}
@@ -387,16 +375,11 @@ TEST(SchemaValidator, Ref_AllOf) {
387
375
SchemaDocument s (sd);
388
376
389
377
INVALIDATE (s, " {\" shipping_address\" : {\" street_address\" : \" 1600 Pennsylvania Avenue NW\" , \" city\" : \" Washington\" , \" state\" : \" DC\" } }" , " /properties/shipping_address" , " allOf" , " /shipping_address" ,
390
- " { \" allOf \" : {"
378
+ " { \" required \" : {"
391
379
" \" instanceRef\" : \" #/shipping_address\" ,"
392
- " \" schemaRef\" : \" #/properties/shipping_address\" ,"
393
- " \" errors\" : ["
394
- " {},"
395
- " { \" required\" : {"
396
- " \" instanceRef\" : \" #/shipping_address\" ,"
397
- " \" schemaRef\" : \" #/properties/shipping_address/allOf/1\" ,"
398
- " \" missing\" : [\" type\" ]"
399
- " }} ] }}" );
380
+ " \" schemaRef\" : \" #/properties/shipping_address/allOf/1\" ,"
381
+ " \" missing\" : [\" type\" ]"
382
+ " }}" );
400
383
VALIDATE (s, " {\" shipping_address\" : {\" street_address\" : \" 1600 Pennsylvania Avenue NW\" , \" city\" : \" Washington\" , \" state\" : \" DC\" , \" type\" : \" business\" } }" , true );
401
384
}
402
385
@@ -1537,87 +1520,48 @@ TEST(SchemaValidator, AllOf_Nested) {
1537
1520
VALIDATE (s, " \" ok\" " , true );
1538
1521
VALIDATE (s, " \" OK\" " , true );
1539
1522
INVALIDATE (s, " \" okay\" " , " " , " allOf" , " " ,
1540
- " { \" allOf\" : {"
1541
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
1542
- " \" errors\" : ["
1543
- " {}, "
1544
- " {}, "
1545
- " { \" allOf\" : {"
1546
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2\" ,"
1547
- " \" errors\" : ["
1548
- " {}, "
1549
- " { \" enum\" : {"
1550
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" "
1551
- " }} ] }} ] }}" );
1523
+ " { \" enum\" : {"
1524
+ " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" "
1525
+ " }}" );
1552
1526
INVALIDATE (s, " \" o\" " , " " , " allOf" , " " ,
1553
- " { \" allOf\" : {"
1554
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
1555
- " \" errors\" : ["
1556
- " { \" minLength\" : {"
1557
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
1558
- " \" expected\" : 2, \" actual\" : \" o\" "
1559
- " }},"
1560
- " {},"
1561
- " {}"
1562
- " ]"
1527
+ " { \" minLength\" : {"
1528
+ " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
1529
+ " \" expected\" : 2, \" actual\" : \" o\" "
1563
1530
" }}" );
1564
1531
INVALIDATE (s, " \" n\" " , " " , " allOf" , " " ,
1565
- " { \" allOf\" : {"
1566
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
1567
- " \" errors\" : ["
1568
- " { \" minLength\" : {"
1569
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
1570
- " \" expected\" : 2, \" actual\" : \" n\" "
1571
- " }},"
1572
- " {}, "
1573
- " { \" allOf\" : {"
1574
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2\" ,"
1575
- " \" errors\" : ["
1576
- " { \" enum\" : {"
1577
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/0\" "
1578
- " }},"
1579
- " { \" enum\" : {"
1580
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" "
1581
- " }} ] }} ] }}" );
1532
+ " { \" minLength\" : {"
1533
+ " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
1534
+ " \" expected\" : 2, \" actual\" : \" n\" "
1535
+ " },"
1536
+ " \" enum\" : ["
1537
+ " {\" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/0\" },"
1538
+ " {\" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" }"
1539
+ " ]"
1540
+ " }" )
1582
1541
INVALIDATE (s, " \" too long\" " , " " , " allOf" , " " ,
1583
- " { \" allOf\" : {"
1584
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
1585
- " \" errors\" : ["
1586
- " {}, "
1587
- " { \" maxLength\" : {"
1588
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/1\" ,"
1589
- " \" expected\" : 5, \" actual\" : \" too long\" "
1590
- " }},"
1591
- " { \" allOf\" : {"
1592
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2\" ,"
1593
- " \" errors\" : ["
1594
- " { \" enum\" : {"
1595
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/0\" "
1596
- " }},"
1597
- " { \" enum\" : {"
1598
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" "
1599
- " }} ] }} ] }}" );
1542
+ " { \" maxLength\" : {"
1543
+ " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/1\" ,"
1544
+ " \" expected\" : 5, \" actual\" : \" too long\" "
1545
+ " },"
1546
+ " \" enum\" : ["
1547
+ " {\" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/0\" },"
1548
+ " {\" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" }"
1549
+ " ]"
1550
+ " }" );
1600
1551
INVALIDATE (s, " 123" , " " , " allOf" , " " ,
1601
- " { \" allOf\" : {"
1602
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #\" ,"
1603
- " \" errors\" : ["
1604
- " { \" type\" : {"
1605
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
1606
- " \" expected\" : [\" string\" ], \" actual\" : \" integer\" "
1607
- " }},"
1608
- " { \" type\" : {"
1609
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/1\" ,"
1610
- " \" expected\" : [\" string\" ], \" actual\" : \" integer\" "
1611
- " }},"
1612
- " { \" allOf\" : {"
1613
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2\" ,"
1614
- " \" errors\" : ["
1615
- " { \" enum\" : {"
1616
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/0\" "
1617
- " }}, "
1618
- " { \" enum\" : {"
1619
- " \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" "
1620
- " }} ] }} ] }}" );
1552
+ " { \" type\" : ["
1553
+ " { \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/0\" ,"
1554
+ " \" expected\" : [\" string\" ], \" actual\" : \" integer\" "
1555
+ " },"
1556
+ " { \" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/1\" ,"
1557
+ " \" expected\" : [\" string\" ], \" actual\" : \" integer\" "
1558
+ " }"
1559
+ " ],"
1560
+ " \" enum\" : ["
1561
+ " {\" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/0\" },"
1562
+ " {\" instanceRef\" : \" #\" , \" schemaRef\" : \" #/allOf/2/allOf/1\" }"
1563
+ " ]"
1564
+ " }" );
1621
1565
}
1622
1566
1623
1567
TEST (SchemaValidator, EscapedPointer) {
0 commit comments