cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft7/uniqueItems.json (about) 1 [ 2 { 3 "description": "uniqueItems validation", 4 "schema": { 5 "uniqueItems": true 6 }, 7 "tests": [ 8 { 9 "description": "unique array of integers is valid", 10 "data": [ 11 1, 12 2 13 ], 14 "valid": true 15 }, 16 { 17 "description": "non-unique array of integers is invalid", 18 "data": [ 19 1, 20 1 21 ], 22 "valid": false 23 }, 24 { 25 "description": "non-unique array of more than two integers is invalid", 26 "data": [ 27 1, 28 2, 29 1 30 ], 31 "valid": false 32 }, 33 { 34 "description": "numbers are unique if mathematically unequal", 35 "data": [ 36 1.0, 37 1.00, 38 1 39 ], 40 "valid": false 41 }, 42 { 43 "description": "false is not equal to zero", 44 "data": [ 45 0, 46 false 47 ], 48 "valid": true 49 }, 50 { 51 "description": "true is not equal to one", 52 "data": [ 53 1, 54 true 55 ], 56 "valid": true 57 }, 58 { 59 "description": "unique array of strings is valid", 60 "data": [ 61 "foo", 62 "bar", 63 "baz" 64 ], 65 "valid": true 66 }, 67 { 68 "description": "non-unique array of strings is invalid", 69 "data": [ 70 "foo", 71 "bar", 72 "foo" 73 ], 74 "valid": false 75 }, 76 { 77 "description": "unique array of objects is valid", 78 "data": [ 79 { 80 "foo": "bar" 81 }, 82 { 83 "foo": "baz" 84 } 85 ], 86 "valid": true 87 }, 88 { 89 "description": "non-unique array of objects is invalid", 90 "data": [ 91 { 92 "foo": "bar" 93 }, 94 { 95 "foo": "bar" 96 } 97 ], 98 "valid": false 99 }, 100 { 101 "description": "property order of array of objects is ignored", 102 "data": [ 103 { 104 "foo": "bar", 105 "bar": "foo" 106 }, 107 { 108 "bar": "foo", 109 "foo": "bar" 110 } 111 ], 112 "valid": false 113 }, 114 { 115 "description": "unique array of nested objects is valid", 116 "data": [ 117 { 118 "foo": { 119 "bar": { 120 "baz": true 121 } 122 } 123 }, 124 { 125 "foo": { 126 "bar": { 127 "baz": false 128 } 129 } 130 } 131 ], 132 "valid": true 133 }, 134 { 135 "description": "non-unique array of nested objects is invalid", 136 "data": [ 137 { 138 "foo": { 139 "bar": { 140 "baz": true 141 } 142 } 143 }, 144 { 145 "foo": { 146 "bar": { 147 "baz": true 148 } 149 } 150 } 151 ], 152 "valid": false 153 }, 154 { 155 "description": "unique array of arrays is valid", 156 "data": [ 157 [ 158 "foo" 159 ], 160 [ 161 "bar" 162 ] 163 ], 164 "valid": true 165 }, 166 { 167 "description": "non-unique array of arrays is invalid", 168 "data": [ 169 [ 170 "foo" 171 ], 172 [ 173 "foo" 174 ] 175 ], 176 "valid": false 177 }, 178 { 179 "description": "non-unique array of more than two arrays is invalid", 180 "data": [ 181 [ 182 "foo" 183 ], 184 [ 185 "bar" 186 ], 187 [ 188 "foo" 189 ] 190 ], 191 "valid": false 192 }, 193 { 194 "description": "1 and true are unique", 195 "data": [ 196 1, 197 true 198 ], 199 "valid": true 200 }, 201 { 202 "description": "0 and false are unique", 203 "data": [ 204 0, 205 false 206 ], 207 "valid": true 208 }, 209 { 210 "description": "[1] and [true] are unique", 211 "data": [ 212 [ 213 1 214 ], 215 [ 216 true 217 ] 218 ], 219 "valid": true 220 }, 221 { 222 "description": "[0] and [false] are unique", 223 "data": [ 224 [ 225 0 226 ], 227 [ 228 false 229 ] 230 ], 231 "valid": true 232 }, 233 { 234 "description": "nested [1] and [true] are unique", 235 "data": [ 236 [ 237 [ 238 1 239 ], 240 "foo" 241 ], 242 [ 243 [ 244 true 245 ], 246 "foo" 247 ] 248 ], 249 "valid": true 250 }, 251 { 252 "description": "nested [0] and [false] are unique", 253 "data": [ 254 [ 255 [ 256 0 257 ], 258 "foo" 259 ], 260 [ 261 [ 262 false 263 ], 264 "foo" 265 ] 266 ], 267 "valid": true 268 }, 269 { 270 "description": "unique heterogeneous types are valid", 271 "data": [ 272 {}, 273 [ 274 1 275 ], 276 true, 277 null, 278 1, 279 "{}" 280 ], 281 "valid": true 282 }, 283 { 284 "description": "non-unique heterogeneous types are invalid", 285 "data": [ 286 {}, 287 [ 288 1 289 ], 290 true, 291 null, 292 {}, 293 1 294 ], 295 "valid": false 296 }, 297 { 298 "description": "different objects are unique", 299 "data": [ 300 { 301 "a": 1, 302 "b": 2 303 }, 304 { 305 "a": 2, 306 "b": 1 307 } 308 ], 309 "valid": true 310 }, 311 { 312 "description": "objects are non-unique despite key order", 313 "data": [ 314 { 315 "a": 1, 316 "b": 2 317 }, 318 { 319 "b": 2, 320 "a": 1 321 } 322 ], 323 "valid": false 324 }, 325 { 326 "description": "{\"a\": false} and {\"a\": 0} are unique", 327 "data": [ 328 { 329 "a": false 330 }, 331 { 332 "a": 0 333 } 334 ], 335 "valid": true 336 }, 337 { 338 "description": "{\"a\": true} and {\"a\": 1} are unique", 339 "data": [ 340 { 341 "a": true 342 }, 343 { 344 "a": 1 345 } 346 ], 347 "valid": true 348 } 349 ] 350 }, 351 { 352 "description": "uniqueItems with an array of items", 353 "schema": { 354 "items": [ 355 { 356 "type": "boolean" 357 }, 358 { 359 "type": "boolean" 360 } 361 ], 362 "uniqueItems": true 363 }, 364 "tests": [ 365 { 366 "description": "[false, true] from items array is valid", 367 "data": [ 368 false, 369 true 370 ], 371 "valid": true 372 }, 373 { 374 "description": "[true, false] from items array is valid", 375 "data": [ 376 true, 377 false 378 ], 379 "valid": true 380 }, 381 { 382 "description": "[false, false] from items array is not valid", 383 "data": [ 384 false, 385 false 386 ], 387 "valid": false 388 }, 389 { 390 "description": "[true, true] from items array is not valid", 391 "data": [ 392 true, 393 true 394 ], 395 "valid": false 396 }, 397 { 398 "description": "unique array extended from [false, true] is valid", 399 "data": [ 400 false, 401 true, 402 "foo", 403 "bar" 404 ], 405 "valid": true 406 }, 407 { 408 "description": "unique array extended from [true, false] is valid", 409 "data": [ 410 true, 411 false, 412 "foo", 413 "bar" 414 ], 415 "valid": true 416 }, 417 { 418 "description": "non-unique array extended from [false, true] is not valid", 419 "data": [ 420 false, 421 true, 422 "foo", 423 "foo" 424 ], 425 "valid": false 426 }, 427 { 428 "description": "non-unique array extended from [true, false] is not valid", 429 "data": [ 430 true, 431 false, 432 "foo", 433 "foo" 434 ], 435 "valid": false 436 } 437 ] 438 }, 439 { 440 "description": "uniqueItems with an array of items and additionalItems=false", 441 "schema": { 442 "items": [ 443 { 444 "type": "boolean" 445 }, 446 { 447 "type": "boolean" 448 } 449 ], 450 "uniqueItems": true, 451 "additionalItems": false 452 }, 453 "tests": [ 454 { 455 "description": "[false, true] from items array is valid", 456 "data": [ 457 false, 458 true 459 ], 460 "valid": true 461 }, 462 { 463 "description": "[true, false] from items array is valid", 464 "data": [ 465 true, 466 false 467 ], 468 "valid": true 469 }, 470 { 471 "description": "[false, false] from items array is not valid", 472 "data": [ 473 false, 474 false 475 ], 476 "valid": false 477 }, 478 { 479 "description": "[true, true] from items array is not valid", 480 "data": [ 481 true, 482 true 483 ], 484 "valid": false 485 }, 486 { 487 "description": "extra items are invalid even if unique", 488 "data": [ 489 false, 490 true, 491 null 492 ], 493 "valid": false 494 } 495 ] 496 }, 497 { 498 "description": "uniqueItems=false validation", 499 "schema": { 500 "uniqueItems": false 501 }, 502 "tests": [ 503 { 504 "description": "unique array of integers is valid", 505 "data": [ 506 1, 507 2 508 ], 509 "valid": true 510 }, 511 { 512 "description": "non-unique array of integers is valid", 513 "data": [ 514 1, 515 1 516 ], 517 "valid": true 518 }, 519 { 520 "description": "numbers are unique if mathematically unequal", 521 "data": [ 522 1.0, 523 1.00, 524 1 525 ], 526 "valid": true 527 }, 528 { 529 "description": "false is not equal to zero", 530 "data": [ 531 0, 532 false 533 ], 534 "valid": true 535 }, 536 { 537 "description": "true is not equal to one", 538 "data": [ 539 1, 540 true 541 ], 542 "valid": true 543 }, 544 { 545 "description": "unique array of objects is valid", 546 "data": [ 547 { 548 "foo": "bar" 549 }, 550 { 551 "foo": "baz" 552 } 553 ], 554 "valid": true 555 }, 556 { 557 "description": "non-unique array of objects is valid", 558 "data": [ 559 { 560 "foo": "bar" 561 }, 562 { 563 "foo": "bar" 564 } 565 ], 566 "valid": true 567 }, 568 { 569 "description": "unique array of nested objects is valid", 570 "data": [ 571 { 572 "foo": { 573 "bar": { 574 "baz": true 575 } 576 } 577 }, 578 { 579 "foo": { 580 "bar": { 581 "baz": false 582 } 583 } 584 } 585 ], 586 "valid": true 587 }, 588 { 589 "description": "non-unique array of nested objects is valid", 590 "data": [ 591 { 592 "foo": { 593 "bar": { 594 "baz": true 595 } 596 } 597 }, 598 { 599 "foo": { 600 "bar": { 601 "baz": true 602 } 603 } 604 } 605 ], 606 "valid": true 607 }, 608 { 609 "description": "unique array of arrays is valid", 610 "data": [ 611 [ 612 "foo" 613 ], 614 [ 615 "bar" 616 ] 617 ], 618 "valid": true 619 }, 620 { 621 "description": "non-unique array of arrays is valid", 622 "data": [ 623 [ 624 "foo" 625 ], 626 [ 627 "foo" 628 ] 629 ], 630 "valid": true 631 }, 632 { 633 "description": "1 and true are unique", 634 "data": [ 635 1, 636 true 637 ], 638 "valid": true 639 }, 640 { 641 "description": "0 and false are unique", 642 "data": [ 643 0, 644 false 645 ], 646 "valid": true 647 }, 648 { 649 "description": "unique heterogeneous types are valid", 650 "data": [ 651 {}, 652 [ 653 1 654 ], 655 true, 656 null, 657 1 658 ], 659 "valid": true 660 }, 661 { 662 "description": "non-unique heterogeneous types are valid", 663 "data": [ 664 {}, 665 [ 666 1 667 ], 668 true, 669 null, 670 {}, 671 1 672 ], 673 "valid": true 674 } 675 ] 676 }, 677 { 678 "description": "uniqueItems=false with an array of items", 679 "schema": { 680 "items": [ 681 { 682 "type": "boolean" 683 }, 684 { 685 "type": "boolean" 686 } 687 ], 688 "uniqueItems": false 689 }, 690 "tests": [ 691 { 692 "description": "[false, true] from items array is valid", 693 "data": [ 694 false, 695 true 696 ], 697 "valid": true 698 }, 699 { 700 "description": "[true, false] from items array is valid", 701 "data": [ 702 true, 703 false 704 ], 705 "valid": true 706 }, 707 { 708 "description": "[false, false] from items array is valid", 709 "data": [ 710 false, 711 false 712 ], 713 "valid": true 714 }, 715 { 716 "description": "[true, true] from items array is valid", 717 "data": [ 718 true, 719 true 720 ], 721 "valid": true 722 }, 723 { 724 "description": "unique array extended from [false, true] is valid", 725 "data": [ 726 false, 727 true, 728 "foo", 729 "bar" 730 ], 731 "valid": true 732 }, 733 { 734 "description": "unique array extended from [true, false] is valid", 735 "data": [ 736 true, 737 false, 738 "foo", 739 "bar" 740 ], 741 "valid": true 742 }, 743 { 744 "description": "non-unique array extended from [false, true] is valid", 745 "data": [ 746 false, 747 true, 748 "foo", 749 "foo" 750 ], 751 "valid": true 752 }, 753 { 754 "description": "non-unique array extended from [true, false] is valid", 755 "data": [ 756 true, 757 false, 758 "foo", 759 "foo" 760 ], 761 "valid": true 762 } 763 ] 764 }, 765 { 766 "description": "uniqueItems=false with an array of items and additionalItems=false", 767 "schema": { 768 "items": [ 769 { 770 "type": "boolean" 771 }, 772 { 773 "type": "boolean" 774 } 775 ], 776 "uniqueItems": false, 777 "additionalItems": false 778 }, 779 "tests": [ 780 { 781 "description": "[false, true] from items array is valid", 782 "data": [ 783 false, 784 true 785 ], 786 "valid": true 787 }, 788 { 789 "description": "[true, false] from items array is valid", 790 "data": [ 791 true, 792 false 793 ], 794 "valid": true 795 }, 796 { 797 "description": "[false, false] from items array is valid", 798 "data": [ 799 false, 800 false 801 ], 802 "valid": true 803 }, 804 { 805 "description": "[true, true] from items array is valid", 806 "data": [ 807 true, 808 true 809 ], 810 "valid": true 811 }, 812 { 813 "description": "extra items are invalid even if unique", 814 "data": [ 815 false, 816 true, 817 null 818 ], 819 "valid": false 820 } 821 ] 822 } 823 ]