cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft6/ref.json (about) 1 [ 2 { 3 "description": "root pointer ref", 4 "schema": { 5 "properties": { 6 "foo": { 7 "$ref": "#" 8 } 9 }, 10 "additionalProperties": false 11 }, 12 "tests": [ 13 { 14 "description": "match", 15 "data": { 16 "foo": false 17 }, 18 "valid": true 19 }, 20 { 21 "description": "recursive match", 22 "data": { 23 "foo": { 24 "foo": false 25 } 26 }, 27 "valid": true 28 }, 29 { 30 "description": "mismatch", 31 "data": { 32 "bar": false 33 }, 34 "valid": false 35 }, 36 { 37 "description": "recursive mismatch", 38 "data": { 39 "foo": { 40 "bar": false 41 } 42 }, 43 "valid": false 44 } 45 ] 46 }, 47 { 48 "description": "relative pointer ref to object", 49 "schema": { 50 "properties": { 51 "foo": { 52 "type": "integer" 53 }, 54 "bar": { 55 "$ref": "#/properties/foo" 56 } 57 } 58 }, 59 "tests": [ 60 { 61 "description": "match", 62 "data": { 63 "bar": 3 64 }, 65 "valid": true 66 }, 67 { 68 "description": "mismatch", 69 "data": { 70 "bar": true 71 }, 72 "valid": false 73 } 74 ] 75 }, 76 { 77 "description": "relative pointer ref to array", 78 "schema": { 79 "items": [ 80 { 81 "type": "integer" 82 }, 83 { 84 "$ref": "#/items/0" 85 } 86 ] 87 }, 88 "tests": [ 89 { 90 "description": "match array", 91 "data": [ 92 1, 93 2 94 ], 95 "valid": true 96 }, 97 { 98 "description": "mismatch array", 99 "data": [ 100 1, 101 "foo" 102 ], 103 "valid": false 104 } 105 ] 106 }, 107 { 108 "description": "escaped pointer ref", 109 "schema": { 110 "definitions": { 111 "tilde~field": { 112 "type": "integer" 113 }, 114 "slash/field": { 115 "type": "integer" 116 }, 117 "percent%field": { 118 "type": "integer" 119 } 120 }, 121 "properties": { 122 "tilde": { 123 "$ref": "#/definitions/tilde~0field" 124 }, 125 "slash": { 126 "$ref": "#/definitions/slash~1field" 127 }, 128 "percent": { 129 "$ref": "#/definitions/percent%25field" 130 } 131 } 132 }, 133 "tests": [ 134 { 135 "description": "slash invalid", 136 "data": { 137 "slash": "aoeu" 138 }, 139 "valid": false 140 }, 141 { 142 "description": "tilde invalid", 143 "data": { 144 "tilde": "aoeu" 145 }, 146 "valid": false 147 }, 148 { 149 "description": "percent invalid", 150 "data": { 151 "percent": "aoeu" 152 }, 153 "valid": false 154 }, 155 { 156 "description": "slash valid", 157 "data": { 158 "slash": 123 159 }, 160 "valid": true 161 }, 162 { 163 "description": "tilde valid", 164 "data": { 165 "tilde": 123 166 }, 167 "valid": true 168 }, 169 { 170 "description": "percent valid", 171 "data": { 172 "percent": 123 173 }, 174 "valid": true 175 } 176 ] 177 }, 178 { 179 "description": "nested refs", 180 "schema": { 181 "definitions": { 182 "a": { 183 "type": "integer" 184 }, 185 "b": { 186 "$ref": "#/definitions/a" 187 }, 188 "c": { 189 "$ref": "#/definitions/b" 190 } 191 }, 192 "allOf": [ 193 { 194 "$ref": "#/definitions/c" 195 } 196 ] 197 }, 198 "tests": [ 199 { 200 "description": "nested ref valid", 201 "data": 5, 202 "valid": true 203 }, 204 { 205 "description": "nested ref invalid", 206 "data": "a", 207 "valid": false 208 } 209 ] 210 }, 211 { 212 "description": "ref overrides any sibling keywords", 213 "schema": { 214 "definitions": { 215 "reffed": { 216 "type": "array" 217 } 218 }, 219 "properties": { 220 "foo": { 221 "$ref": "#/definitions/reffed", 222 "maxItems": 2 223 } 224 } 225 }, 226 "tests": [ 227 { 228 "description": "ref valid", 229 "data": { 230 "foo": [] 231 }, 232 "valid": true 233 }, 234 { 235 "description": "ref valid, maxItems ignored", 236 "data": { 237 "foo": [ 238 1, 239 2, 240 3 241 ] 242 }, 243 "valid": true 244 }, 245 { 246 "description": "ref invalid", 247 "data": { 248 "foo": "string" 249 }, 250 "valid": false 251 } 252 ] 253 }, 254 { 255 "description": "$ref prevents a sibling $id from changing the base uri", 256 "schema": { 257 "$id": "http://localhost:1234/sibling_id/base/", 258 "definitions": { 259 "foo": { 260 "$id": "http://localhost:1234/sibling_id/foo.json", 261 "type": "string" 262 }, 263 "base_foo": { 264 "$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json", 265 "$id": "foo.json", 266 "type": "number" 267 } 268 }, 269 "allOf": [ 270 { 271 "$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not http://localhost:1234/sibling_id/foo.json", 272 "$id": "http://localhost:1234/sibling_id/", 273 "$ref": "foo.json" 274 } 275 ] 276 }, 277 "tests": [ 278 { 279 "description": "$ref resolves to /definitions/base_foo, data does not validate", 280 "data": "a", 281 "valid": false 282 }, 283 { 284 "description": "$ref resolves to /definitions/base_foo, data validates", 285 "data": 1, 286 "valid": true 287 } 288 ] 289 }, 290 { 291 "description": "remote ref, containing refs itself", 292 "schema": { 293 "$ref": "http://json-schema.org/draft-06/schema#" 294 }, 295 "skip": { 296 "v2": "extract error: cannot compile resulting schema: package \"json-schema.org/draft-06/schema\" imported but not defined in :\n generated.cue:1:8\n", 297 "v3": "extract error: cannot compile resulting schema: package \"json-schema.org/draft-06/schema\" imported but not defined in :\n generated.cue:1:8\n" 298 }, 299 "tests": [ 300 { 301 "description": "remote ref valid", 302 "data": { 303 "minLength": 1 304 }, 305 "valid": true, 306 "skip": { 307 "v2": "could not compile schema", 308 "v3": "could not compile schema" 309 } 310 }, 311 { 312 "description": "remote ref invalid", 313 "data": { 314 "minLength": -1 315 }, 316 "valid": false, 317 "skip": { 318 "v2": "could not compile schema", 319 "v3": "could not compile schema" 320 } 321 } 322 ] 323 }, 324 { 325 "description": "property named $ref that is not a reference", 326 "schema": { 327 "properties": { 328 "$ref": { 329 "type": "string" 330 } 331 } 332 }, 333 "tests": [ 334 { 335 "description": "property named $ref valid", 336 "data": { 337 "$ref": "a" 338 }, 339 "valid": true 340 }, 341 { 342 "description": "property named $ref invalid", 343 "data": { 344 "$ref": 2 345 }, 346 "valid": false 347 } 348 ] 349 }, 350 { 351 "description": "property named $ref, containing an actual $ref", 352 "schema": { 353 "properties": { 354 "$ref": { 355 "$ref": "#/definitions/is-string" 356 } 357 }, 358 "definitions": { 359 "is-string": { 360 "type": "string" 361 } 362 } 363 }, 364 "tests": [ 365 { 366 "description": "property named $ref valid", 367 "data": { 368 "$ref": "a" 369 }, 370 "valid": true 371 }, 372 { 373 "description": "property named $ref invalid", 374 "data": { 375 "$ref": 2 376 }, 377 "valid": false 378 } 379 ] 380 }, 381 { 382 "description": "$ref to boolean schema true", 383 "schema": { 384 "allOf": [ 385 { 386 "$ref": "#/definitions/bool" 387 } 388 ], 389 "definitions": { 390 "bool": true 391 } 392 }, 393 "tests": [ 394 { 395 "description": "any value is valid", 396 "data": "foo", 397 "valid": true 398 } 399 ] 400 }, 401 { 402 "description": "$ref to boolean schema false", 403 "schema": { 404 "allOf": [ 405 { 406 "$ref": "#/definitions/bool" 407 } 408 ], 409 "definitions": { 410 "bool": false 411 } 412 }, 413 "skip": { 414 "v2": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:4:8\n", 415 "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:4:8\n" 416 }, 417 "tests": [ 418 { 419 "description": "any value is invalid", 420 "data": "foo", 421 "valid": false, 422 "skip": { 423 "v2": "could not compile schema", 424 "v3": "could not compile schema" 425 } 426 } 427 ] 428 }, 429 { 430 "description": "Recursive references between schemas", 431 "schema": { 432 "$id": "http://localhost:1234/tree", 433 "description": "tree of nodes", 434 "type": "object", 435 "properties": { 436 "meta": { 437 "type": "string" 438 }, 439 "nodes": { 440 "type": "array", 441 "items": { 442 "$ref": "node" 443 } 444 } 445 }, 446 "required": [ 447 "meta", 448 "nodes" 449 ], 450 "definitions": { 451 "node": { 452 "$id": "http://localhost:1234/node", 453 "description": "node", 454 "type": "object", 455 "properties": { 456 "value": { 457 "type": "number" 458 }, 459 "subtree": { 460 "$ref": "tree" 461 } 462 }, 463 "required": [ 464 "value" 465 ] 466 } 467 } 468 }, 469 "tests": [ 470 { 471 "description": "valid tree", 472 "data": { 473 "meta": "root", 474 "nodes": [ 475 { 476 "value": 1, 477 "subtree": { 478 "meta": "child", 479 "nodes": [ 480 { 481 "value": 1.1 482 }, 483 { 484 "value": 1.2 485 } 486 ] 487 } 488 }, 489 { 490 "value": 2, 491 "subtree": { 492 "meta": "child", 493 "nodes": [ 494 { 495 "value": 2.1 496 }, 497 { 498 "value": 2.2 499 } 500 ] 501 } 502 } 503 ] 504 }, 505 "valid": true 506 }, 507 { 508 "description": "invalid tree", 509 "data": { 510 "meta": "root", 511 "nodes": [ 512 { 513 "value": 1, 514 "subtree": { 515 "meta": "child", 516 "nodes": [ 517 { 518 "value": "string is invalid" 519 }, 520 { 521 "value": 1.2 522 } 523 ] 524 } 525 }, 526 { 527 "value": 2, 528 "subtree": { 529 "meta": "child", 530 "nodes": [ 531 { 532 "value": 2.1 533 }, 534 { 535 "value": 2.2 536 } 537 ] 538 } 539 } 540 ] 541 }, 542 "valid": false 543 } 544 ] 545 }, 546 { 547 "description": "refs with quote", 548 "schema": { 549 "properties": { 550 "foo\"bar": { 551 "$ref": "#/definitions/foo%22bar" 552 } 553 }, 554 "definitions": { 555 "foo\"bar": { 556 "type": "number" 557 } 558 } 559 }, 560 "tests": [ 561 { 562 "description": "object with numbers is valid", 563 "data": { 564 "foo\"bar": 1 565 }, 566 "valid": true 567 }, 568 { 569 "description": "object with strings is invalid", 570 "data": { 571 "foo\"bar": "1" 572 }, 573 "valid": false 574 } 575 ] 576 }, 577 { 578 "description": "Location-independent identifier", 579 "schema": { 580 "allOf": [ 581 { 582 "$ref": "#foo" 583 } 584 ], 585 "definitions": { 586 "A": { 587 "$id": "#foo", 588 "type": "integer" 589 } 590 } 591 }, 592 "skip": { 593 "v2": "extract error: $id URI may not contain a fragment (and 3 more errors)", 594 "v3": "extract error: $id URI may not contain a fragment (and 3 more errors)" 595 }, 596 "tests": [ 597 { 598 "description": "match", 599 "data": 1, 600 "valid": true, 601 "skip": { 602 "v2": "could not compile schema", 603 "v3": "could not compile schema" 604 } 605 }, 606 { 607 "description": "mismatch", 608 "data": "a", 609 "valid": false, 610 "skip": { 611 "v2": "could not compile schema", 612 "v3": "could not compile schema" 613 } 614 } 615 ] 616 }, 617 { 618 "description": "Reference an anchor with a non-relative URI", 619 "schema": { 620 "$id": "https://example.com/schema-with-anchor", 621 "allOf": [ 622 { 623 "$ref": "https://example.com/schema-with-anchor#foo" 624 } 625 ], 626 "definitions": { 627 "A": { 628 "$id": "#foo", 629 "type": "integer" 630 } 631 } 632 }, 633 "skip": { 634 "v2": "extract error: $id URI may not contain a fragment (and 3 more errors)", 635 "v3": "extract error: $id URI may not contain a fragment (and 3 more errors)" 636 }, 637 "tests": [ 638 { 639 "description": "match", 640 "data": 1, 641 "valid": true, 642 "skip": { 643 "v2": "could not compile schema", 644 "v3": "could not compile schema" 645 } 646 }, 647 { 648 "description": "mismatch", 649 "data": "a", 650 "valid": false, 651 "skip": { 652 "v2": "could not compile schema", 653 "v3": "could not compile schema" 654 } 655 } 656 ] 657 }, 658 { 659 "description": "Location-independent identifier with base URI change in subschema", 660 "schema": { 661 "$id": "http://localhost:1234/root", 662 "allOf": [ 663 { 664 "$ref": "http://localhost:1234/nested.json#foo" 665 } 666 ], 667 "definitions": { 668 "A": { 669 "$id": "nested.json", 670 "definitions": { 671 "B": { 672 "$id": "#foo", 673 "type": "integer" 674 } 675 } 676 } 677 } 678 }, 679 "skip": { 680 "v2": "extract error: $id URI may not contain a fragment (and 3 more errors)", 681 "v3": "extract error: $id URI may not contain a fragment (and 3 more errors)" 682 }, 683 "tests": [ 684 { 685 "description": "match", 686 "data": 1, 687 "valid": true, 688 "skip": { 689 "v2": "could not compile schema", 690 "v3": "could not compile schema" 691 } 692 }, 693 { 694 "description": "mismatch", 695 "data": "a", 696 "valid": false, 697 "skip": { 698 "v2": "could not compile schema", 699 "v3": "could not compile schema" 700 } 701 } 702 ] 703 }, 704 { 705 "description": "naive replacement of $ref with its destination is not correct", 706 "schema": { 707 "definitions": { 708 "a_string": { 709 "type": "string" 710 } 711 }, 712 "enum": [ 713 { 714 "$ref": "#/definitions/a_string" 715 } 716 ] 717 }, 718 "tests": [ 719 { 720 "description": "do not evaluate the $ref inside the enum, matching any string", 721 "data": "this is a string", 722 "valid": false 723 }, 724 { 725 "description": "do not evaluate the $ref inside the enum, definition exact match", 726 "data": { 727 "type": "string" 728 }, 729 "valid": false 730 }, 731 { 732 "description": "match the enum exactly", 733 "data": { 734 "$ref": "#/definitions/a_string" 735 }, 736 "valid": true 737 } 738 ] 739 }, 740 { 741 "description": "refs with relative uris and defs", 742 "schema": { 743 "$id": "http://example.com/schema-relative-uri-defs1.json", 744 "properties": { 745 "foo": { 746 "$id": "schema-relative-uri-defs2.json", 747 "definitions": { 748 "inner": { 749 "properties": { 750 "bar": { 751 "type": "string" 752 } 753 } 754 } 755 }, 756 "allOf": [ 757 { 758 "$ref": "#/definitions/inner" 759 } 760 ] 761 } 762 }, 763 "allOf": [ 764 { 765 "$ref": "schema-relative-uri-defs2.json" 766 } 767 ] 768 }, 769 "tests": [ 770 { 771 "description": "invalid on inner field", 772 "data": { 773 "foo": { 774 "bar": 1 775 }, 776 "bar": "a" 777 }, 778 "valid": false 779 }, 780 { 781 "description": "invalid on outer field", 782 "data": { 783 "foo": { 784 "bar": "a" 785 }, 786 "bar": 1 787 }, 788 "valid": false 789 }, 790 { 791 "description": "valid on both fields", 792 "data": { 793 "foo": { 794 "bar": "a" 795 }, 796 "bar": "a" 797 }, 798 "valid": true 799 } 800 ] 801 }, 802 { 803 "description": "relative refs with absolute uris and defs", 804 "schema": { 805 "$id": "http://example.com/schema-refs-absolute-uris-defs1.json", 806 "properties": { 807 "foo": { 808 "$id": "http://example.com/schema-refs-absolute-uris-defs2.json", 809 "definitions": { 810 "inner": { 811 "properties": { 812 "bar": { 813 "type": "string" 814 } 815 } 816 } 817 }, 818 "allOf": [ 819 { 820 "$ref": "#/definitions/inner" 821 } 822 ] 823 } 824 }, 825 "allOf": [ 826 { 827 "$ref": "schema-refs-absolute-uris-defs2.json" 828 } 829 ] 830 }, 831 "tests": [ 832 { 833 "description": "invalid on inner field", 834 "data": { 835 "foo": { 836 "bar": 1 837 }, 838 "bar": "a" 839 }, 840 "valid": false 841 }, 842 { 843 "description": "invalid on outer field", 844 "data": { 845 "foo": { 846 "bar": "a" 847 }, 848 "bar": 1 849 }, 850 "valid": false 851 }, 852 { 853 "description": "valid on both fields", 854 "data": { 855 "foo": { 856 "bar": "a" 857 }, 858 "bar": "a" 859 }, 860 "valid": true 861 } 862 ] 863 }, 864 { 865 "description": "simple URN base URI with $ref via the URN", 866 "schema": { 867 "$comment": "URIs do not have to have HTTP(s) schemes", 868 "$id": "urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed", 869 "minimum": 30, 870 "properties": { 871 "foo": { 872 "$ref": "urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed" 873 } 874 } 875 }, 876 "tests": [ 877 { 878 "description": "valid under the URN IDed schema", 879 "data": { 880 "foo": 37 881 }, 882 "valid": true 883 }, 884 { 885 "description": "invalid under the URN IDed schema", 886 "data": { 887 "foo": 12 888 }, 889 "valid": false 890 } 891 ] 892 }, 893 { 894 "description": "simple URN base URI with JSON pointer", 895 "schema": { 896 "$comment": "URIs do not have to have HTTP(s) schemes", 897 "$id": "urn:uuid:deadbeef-1234-00ff-ff00-4321feebdaed", 898 "properties": { 899 "foo": { 900 "$ref": "#/definitions/bar" 901 } 902 }, 903 "definitions": { 904 "bar": { 905 "type": "string" 906 } 907 } 908 }, 909 "tests": [ 910 { 911 "description": "a string is valid", 912 "data": { 913 "foo": "bar" 914 }, 915 "valid": true 916 }, 917 { 918 "description": "a non-string is invalid", 919 "data": { 920 "foo": 12 921 }, 922 "valid": false 923 } 924 ] 925 }, 926 { 927 "description": "URN base URI with NSS", 928 "schema": { 929 "$comment": "RFC 8141 §2.2", 930 "$id": "urn:example:1/406/47452/2", 931 "properties": { 932 "foo": { 933 "$ref": "#/definitions/bar" 934 } 935 }, 936 "definitions": { 937 "bar": { 938 "type": "string" 939 } 940 } 941 }, 942 "tests": [ 943 { 944 "description": "a string is valid", 945 "data": { 946 "foo": "bar" 947 }, 948 "valid": true 949 }, 950 { 951 "description": "a non-string is invalid", 952 "data": { 953 "foo": 12 954 }, 955 "valid": false 956 } 957 ] 958 }, 959 { 960 "description": "URN base URI with r-component", 961 "schema": { 962 "$comment": "RFC 8141 §2.3.1", 963 "$id": "urn:example:foo-bar-baz-qux?+CCResolve:cc=uk", 964 "properties": { 965 "foo": { 966 "$ref": "#/definitions/bar" 967 } 968 }, 969 "definitions": { 970 "bar": { 971 "type": "string" 972 } 973 } 974 }, 975 "tests": [ 976 { 977 "description": "a string is valid", 978 "data": { 979 "foo": "bar" 980 }, 981 "valid": true 982 }, 983 { 984 "description": "a non-string is invalid", 985 "data": { 986 "foo": 12 987 }, 988 "valid": false 989 } 990 ] 991 }, 992 { 993 "description": "URN base URI with q-component", 994 "schema": { 995 "$comment": "RFC 8141 §2.3.2", 996 "$id": "urn:example:weather?=op=map\u0026lat=39.56\u0026lon=-104.85\u0026datetime=1969-07-21T02:56:15Z", 997 "properties": { 998 "foo": { 999 "$ref": "#/definitions/bar" 1000 } 1001 }, 1002 "definitions": { 1003 "bar": { 1004 "type": "string" 1005 } 1006 } 1007 }, 1008 "tests": [ 1009 { 1010 "description": "a string is valid", 1011 "data": { 1012 "foo": "bar" 1013 }, 1014 "valid": true 1015 }, 1016 { 1017 "description": "a non-string is invalid", 1018 "data": { 1019 "foo": 12 1020 }, 1021 "valid": false 1022 } 1023 ] 1024 }, 1025 { 1026 "description": "URN base URI with URN and JSON pointer ref", 1027 "schema": { 1028 "$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed", 1029 "properties": { 1030 "foo": { 1031 "$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/definitions/bar" 1032 } 1033 }, 1034 "definitions": { 1035 "bar": { 1036 "type": "string" 1037 } 1038 } 1039 }, 1040 "tests": [ 1041 { 1042 "description": "a string is valid", 1043 "data": { 1044 "foo": "bar" 1045 }, 1046 "valid": true 1047 }, 1048 { 1049 "description": "a non-string is invalid", 1050 "data": { 1051 "foo": 12 1052 }, 1053 "valid": false 1054 } 1055 ] 1056 }, 1057 { 1058 "description": "URN base URI with URN and anchor ref", 1059 "schema": { 1060 "$id": "urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed", 1061 "properties": { 1062 "foo": { 1063 "$ref": "urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed#something" 1064 } 1065 }, 1066 "definitions": { 1067 "bar": { 1068 "$id": "#something", 1069 "type": "string" 1070 } 1071 } 1072 }, 1073 "skip": { 1074 "v2": "extract error: cannot determine CUE location for JSON Schema location id=urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed#something: anchors (something) not supported (and 3 more errors)", 1075 "v3": "extract error: cannot determine CUE location for JSON Schema location id=urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed#something: anchors (something) not supported (and 3 more errors)" 1076 }, 1077 "tests": [ 1078 { 1079 "description": "a string is valid", 1080 "data": { 1081 "foo": "bar" 1082 }, 1083 "valid": true, 1084 "skip": { 1085 "v2": "could not compile schema", 1086 "v3": "could not compile schema" 1087 } 1088 }, 1089 { 1090 "description": "a non-string is invalid", 1091 "data": { 1092 "foo": 12 1093 }, 1094 "valid": false, 1095 "skip": { 1096 "v2": "could not compile schema", 1097 "v3": "could not compile schema" 1098 } 1099 } 1100 ] 1101 }, 1102 { 1103 "description": "ref with absolute-path-reference", 1104 "schema": { 1105 "$id": "http://example.com/ref/absref.json", 1106 "definitions": { 1107 "a": { 1108 "$id": "http://example.com/ref/absref/foobar.json", 1109 "type": "number" 1110 }, 1111 "b": { 1112 "$id": "http://example.com/absref/foobar.json", 1113 "type": "string" 1114 } 1115 }, 1116 "allOf": [ 1117 { 1118 "$ref": "/absref/foobar.json" 1119 } 1120 ] 1121 }, 1122 "tests": [ 1123 { 1124 "description": "a string is valid", 1125 "data": "foo", 1126 "valid": true 1127 }, 1128 { 1129 "description": "an integer is invalid", 1130 "data": 12, 1131 "valid": false 1132 } 1133 ] 1134 }, 1135 { 1136 "description": "$id with file URI still resolves pointers - *nix", 1137 "schema": { 1138 "$id": "file:///folder/file.json", 1139 "definitions": { 1140 "foo": { 1141 "type": "number" 1142 } 1143 }, 1144 "allOf": [ 1145 { 1146 "$ref": "#/definitions/foo" 1147 } 1148 ] 1149 }, 1150 "tests": [ 1151 { 1152 "description": "number is valid", 1153 "data": 1, 1154 "valid": true 1155 }, 1156 { 1157 "description": "non-number is invalid", 1158 "data": "a", 1159 "valid": false 1160 } 1161 ] 1162 }, 1163 { 1164 "description": "$id with file URI still resolves pointers - windows", 1165 "schema": { 1166 "$id": "file:///c:/folder/file.json", 1167 "definitions": { 1168 "foo": { 1169 "type": "number" 1170 } 1171 }, 1172 "allOf": [ 1173 { 1174 "$ref": "#/definitions/foo" 1175 } 1176 ] 1177 }, 1178 "tests": [ 1179 { 1180 "description": "number is valid", 1181 "data": 1, 1182 "valid": true 1183 }, 1184 { 1185 "description": "non-number is invalid", 1186 "data": "a", 1187 "valid": false 1188 } 1189 ] 1190 }, 1191 { 1192 "description": "empty tokens in $ref json-pointer", 1193 "schema": { 1194 "definitions": { 1195 "": { 1196 "definitions": { 1197 "": { 1198 "type": "number" 1199 } 1200 } 1201 } 1202 }, 1203 "allOf": [ 1204 { 1205 "$ref": "#/definitions//definitions/" 1206 } 1207 ] 1208 }, 1209 "tests": [ 1210 { 1211 "description": "number is valid", 1212 "data": 1, 1213 "valid": true 1214 }, 1215 { 1216 "description": "non-number is invalid", 1217 "data": "a", 1218 "valid": false 1219 } 1220 ] 1221 } 1222 ]