Debian Codegraph @

share/tests/v1/unevaluatedProperties.json

raw
1 [
2 {
3 "description": "unevaluatedProperties true",
4 "schema": {
5 "$schema": "https://json-schema.org/v1",
6 "type": "object",
7 "unevaluatedProperties": true
8 },
9 "tests": [
10 {
11 "description": "with no unevaluated properties",
12 "data": {},
13 "valid": true
14 },
15 {
16 "description": "with unevaluated properties",
17 "data": {
18 "foo": "foo"
19 },
20 "valid": true
21 }
22 ]
23 },
24 {
25 "description": "unevaluatedProperties schema",
26 "schema": {
27 "$schema": "https://json-schema.org/v1",
28 "type": "object",
29 "unevaluatedProperties": {
30 "type": "string",
31 "minLength": 3
32 }
33 },
34 "tests": [
35 {
36 "description": "with no unevaluated properties",
37 "data": {},
38 "valid": true
39 },
40 {
41 "description": "with valid unevaluated properties",
42 "data": {
43 "foo": "foo"
44 },
45 "valid": true
46 },
47 {
48 "description": "with invalid unevaluated properties",
49 "data": {
50 "foo": "fo"
51 },
52 "valid": false
53 }
54 ]
55 },
56 {
57 "description": "unevaluatedProperties false",
58 "schema": {
59 "$schema": "https://json-schema.org/v1",
60 "type": "object",
61 "unevaluatedProperties": false
62 },
63 "tests": [
64 {
65 "description": "with no unevaluated properties",
66 "data": {},
67 "valid": true
68 },
69 {
70 "description": "with unevaluated properties",
71 "data": {
72 "foo": "foo"
73 },
74 "valid": false
75 }
76 ]
77 },
78 {
79 "description": "unevaluatedProperties with adjacent properties",
80 "schema": {
81 "$schema": "https://json-schema.org/v1",
82 "type": "object",
83 "properties": {
84 "foo": { "type": "string" }
85 },
86 "unevaluatedProperties": false
87 },
88 "tests": [
89 {
90 "description": "with no unevaluated properties",
91 "data": {
92 "foo": "foo"
93 },
94 "valid": true
95 },
96 {
97 "description": "with unevaluated properties",
98 "data": {
99 "foo": "foo",
100 "bar": "bar"
101 },
102 "valid": false
103 }
104 ]
105 },
106 {
107 "description": "unevaluatedProperties with adjacent patternProperties",
108 "schema": {
109 "$schema": "https://json-schema.org/v1",
110 "type": "object",
111 "patternProperties": {
112 "^foo": { "type": "string" }
113 },
114 "unevaluatedProperties": false
115 },
116 "tests": [
117 {
118 "description": "with no unevaluated properties",
119 "data": {
120 "foo": "foo"
121 },
122 "valid": true
123 },
124 {
125 "description": "with unevaluated properties",
126 "data": {
127 "foo": "foo",
128 "bar": "bar"
129 },
130 "valid": false
131 }
132 ]
133 },
134 {
135 "description": "unevaluatedProperties with adjacent bool additionalProperties",
136 "schema": {
137 "$schema": "https://json-schema.org/v1",
138 "type": "object",
139 "properties": {
140 "foo": { "type": "string" }
141 },
142 "additionalProperties": true,
143 "unevaluatedProperties": false
144 },
145 "tests": [
146 {
147 "description": "with no additional properties",
148 "data": {
149 "foo": "foo"
150 },
151 "valid": true
152 },
153 {
154 "description": "with additional properties",
155 "data": {
156 "foo": "foo",
157 "bar": "bar"
158 },
159 "valid": true
160 }
161 ]
162 },
163 {
164 "description": "unevaluatedProperties with adjacent non-bool additionalProperties",
165 "schema": {
166 "$schema": "https://json-schema.org/v1",
167 "type": "object",
168 "properties": {
169 "foo": { "type": "string" }
170 },
171 "additionalProperties": {"type": "string"},
172 "unevaluatedProperties": false
173 },
174 "tests": [
175 {
176 "description": "with no additional properties",
177 "data": {
178 "foo": "foo"
179 },
180 "valid": true
181 },
182 {
183 "description": "with additional properties",
184 "data": {
185 "foo": "foo",
186 "bar": "bar"
187 },
188 "valid": true
189 }
190 ]
191 },
192 {
193 "description": "unevaluatedProperties with nested properties",
194 "schema": {
195 "$schema": "https://json-schema.org/v1",
196 "type": "object",
197 "properties": {
198 "foo": { "type": "string" }
199 },
200 "allOf": [
201 {
202 "properties": {
203 "bar": { "type": "string" }
204 }
205 }
206 ],
207 "unevaluatedProperties": false
208 },
209 "tests": [
210 {
211 "description": "with no additional properties",
212 "data": {
213 "foo": "foo",
214 "bar": "bar"
215 },
216 "valid": true
217 },
218 {
219 "description": "with additional properties",
220 "data": {
221 "foo": "foo",
222 "bar": "bar",
223 "baz": "baz"
224 },
225 "valid": false
226 }
227 ]
228 },
229 {
230 "description": "unevaluatedProperties with nested patternProperties",
231 "schema": {
232 "$schema": "https://json-schema.org/v1",
233 "type": "object",
234 "properties": {
235 "foo": { "type": "string" }
236 },
237 "allOf": [
238 {
239 "patternProperties": {
240 "^bar": { "type": "string" }
241 }
242 }
243 ],
244 "unevaluatedProperties": false
245 },
246 "tests": [
247 {
248 "description": "with no additional properties",
249 "data": {
250 "foo": "foo",
251 "bar": "bar"
252 },
253 "valid": true
254 },
255 {
256 "description": "with additional properties",
257 "data": {
258 "foo": "foo",
259 "bar": "bar",
260 "baz": "baz"
261 },
262 "valid": false
263 }
264 ]
265 },
266 {
267 "description": "unevaluatedProperties with nested additionalProperties",
268 "schema": {
269 "$schema": "https://json-schema.org/v1",
270 "type": "object",
271 "properties": {
272 "foo": { "type": "string" }
273 },
274 "allOf": [
275 {
276 "additionalProperties": true
277 }
278 ],
279 "unevaluatedProperties": false
280 },
281 "tests": [
282 {
283 "description": "with no additional properties",
284 "data": {
285 "foo": "foo"
286 },
287 "valid": true
288 },
289 {
290 "description": "with additional properties",
291 "data": {
292 "foo": "foo",
293 "bar": "bar"
294 },
295 "valid": true
296 }
297 ]
298 },
299 {
300 "description": "unevaluatedProperties with nested unevaluatedProperties",
301 "schema": {
302 "$schema": "https://json-schema.org/v1",
303 "type": "object",
304 "properties": {
305 "foo": { "type": "string" }
306 },
307 "allOf": [
308 {
309 "unevaluatedProperties": true
310 }
311 ],
312 "unevaluatedProperties": {
313 "type": "string",
314 "maxLength": 2
315 }
316 },
317 "tests": [
318 {
319 "description": "with no nested unevaluated properties",
320 "data": {
321 "foo": "foo"
322 },
323 "valid": true
324 },
325 {
326 "description": "with nested unevaluated properties",
327 "data": {
328 "foo": "foo",
329 "bar": "bar"
330 },
331 "valid": true
332 }
333 ]
334 },
335 {
336 "description": "unevaluatedProperties with anyOf",
337 "schema": {
338 "$schema": "https://json-schema.org/v1",
339 "type": "object",
340 "properties": {
341 "foo": { "type": "string" }
342 },
343 "anyOf": [
344 {
345 "properties": {
346 "bar": { "const": "bar" }
347 },
348 "required": ["bar"]
349 },
350 {
351 "properties": {
352 "baz": { "const": "baz" }
353 },
354 "required": ["baz"]
355 },
356 {
357 "properties": {
358 "quux": { "const": "quux" }
359 },
360 "required": ["quux"]
361 }
362 ],
363 "unevaluatedProperties": false
364 },
365 "tests": [
366 {
367 "description": "when one matches and has no unevaluated properties",
368 "data": {
369 "foo": "foo",
370 "bar": "bar"
371 },
372 "valid": true
373 },
374 {
375 "description": "when one matches and has unevaluated properties",
376 "data": {
377 "foo": "foo",
378 "bar": "bar",
379 "baz": "not-baz"
380 },
381 "valid": false
382 },
383 {
384 "description": "when two match and has no unevaluated properties",
385 "data": {
386 "foo": "foo",
387 "bar": "bar",
388 "baz": "baz"
389 },
390 "valid": true
391 },
392 {
393 "description": "when two match and has unevaluated properties",
394 "data": {
395 "foo": "foo",
396 "bar": "bar",
397 "baz": "baz",
398 "quux": "not-quux"
399 },
400 "valid": false
401 }
402 ]
403 },
404 {
405 "description": "unevaluatedProperties with oneOf",
406 "schema": {
407 "$schema": "https://json-schema.org/v1",
408 "type": "object",
409 "properties": {
410 "foo": { "type": "string" }
411 },
412 "oneOf": [
413 {
414 "properties": {
415 "bar": { "const": "bar" }
416 },
417 "required": ["bar"]
418 },
419 {
420 "properties": {
421 "baz": { "const": "baz" }
422 },
423 "required": ["baz"]
424 }
425 ],
426 "unevaluatedProperties": false
427 },
428 "tests": [
429 {
430 "description": "with no unevaluated properties",
431 "data": {
432 "foo": "foo",
433 "bar": "bar"
434 },
435 "valid": true
436 },
437 {
438 "description": "with unevaluated properties",
439 "data": {
440 "foo": "foo",
441 "bar": "bar",
442 "quux": "quux"
443 },
444 "valid": false
445 }
446 ]
447 },
448 {
449 "description": "unevaluatedProperties with not",
450 "schema": {
451 "$schema": "https://json-schema.org/v1",
452 "type": "object",
453 "properties": {
454 "foo": { "type": "string" }
455 },
456 "not": {
457 "not": {
458 "properties": {
459 "bar": { "const": "bar" }
460 },
461 "required": ["bar"]
462 }
463 },
464 "unevaluatedProperties": false
465 },
466 "tests": [
467 {
468 "description": "with unevaluated properties",
469 "data": {
470 "foo": "foo",
471 "bar": "bar"
472 },
473 "valid": false
474 }
475 ]
476 },
477 {
478 "description": "unevaluatedProperties with if/then/else",
479 "schema": {
480 "$schema": "https://json-schema.org/v1",
481 "type": "object",
482 "if": {
483 "properties": {
484 "foo": { "const": "then" }
485 },
486 "required": ["foo"]
487 },
488 "then": {
489 "properties": {
490 "bar": { "type": "string" }
491 },
492 "required": ["bar"]
493 },
494 "else": {
495 "properties": {
496 "baz": { "type": "string" }
497 },
498 "required": ["baz"]
499 },
500 "unevaluatedProperties": false
501 },
502 "tests": [
503 {
504 "description": "when if is true and has no unevaluated properties",
505 "data": {
506 "foo": "then",
507 "bar": "bar"
508 },
509 "valid": true
510 },
511 {
512 "description": "when if is true and has unevaluated properties",
513 "data": {
514 "foo": "then",
515 "bar": "bar",
516 "baz": "baz"
517 },
518 "valid": false
519 },
520 {
521 "description": "when if is false and has no unevaluated properties",
522 "data": {
523 "baz": "baz"
524 },
525 "valid": true
526 },
527 {
528 "description": "when if is false and has unevaluated properties",
529 "data": {
530 "foo": "else",
531 "baz": "baz"
532 },
533 "valid": false
534 }
535 ]
536 },
537 {
538 "description": "unevaluatedProperties with if/then/else, then not defined",
539 "schema": {
540 "$schema": "https://json-schema.org/v1",
541 "type": "object",
542 "if": {
543 "properties": {
544 "foo": { "const": "then" }
545 },
546 "required": ["foo"]
547 },
548 "else": {
549 "properties": {
550 "baz": { "type": "string" }
551 },
552 "required": ["baz"]
553 },
554 "unevaluatedProperties": false
555 },
556 "tests": [
557 {
558 "description": "when if is true and has no unevaluated properties",
559 "data": {
560 "foo": "then"
561 },
562 "valid": true
563 },
564 {
565 "description": "when if is true and has unevaluated properties",
566 "data": {
567 "foo": "then",
568 "bar": "bar"
569 },
570 "valid": false
571 },
572 {
573 "description": "when if is false and has no unevaluated properties",
574 "data": {
575 "baz": "baz"
576 },
577 "valid": true
578 },
579 {
580 "description": "when if is false and has unevaluated properties",
581 "data": {
582 "foo": "else",
583 "baz": "baz"
584 },
585 "valid": false
586 }
587 ]
588 },
589 {
590 "description": "unevaluatedProperties with if/then/else, else not defined",
591 "schema": {
592 "$schema": "https://json-schema.org/v1",
593 "type": "object",
594 "if": {
595 "properties": {
596 "foo": { "const": "then" }
597 },
598 "required": ["foo"]
599 },
600 "then": {
601 "properties": {
602 "bar": { "type": "string" }
603 },
604 "required": ["bar"]
605 },
606 "unevaluatedProperties": false
607 },
608 "tests": [
609 {
610 "description": "when if is true and has no unevaluated properties",
611 "data": {
612 "foo": "then",
613 "bar": "bar"
614 },
615 "valid": true
616 },
617 {
618 "description": "when if is true and has unevaluated properties",
619 "data": {
620 "foo": "then",
621 "bar": "bar",
622 "baz": "baz"
623 },
624 "valid": false
625 },
626 {
627 "description": "when if is false and has no unevaluated properties",
628 "data": {
629 "baz": "baz"
630 },
631 "valid": false
632 },
633 {
634 "description": "when if is false and has unevaluated properties",
635 "data": {
636 "foo": "else",
637 "baz": "baz"
638 },
639 "valid": false
640 }
641 ]
642 },
643 {
644 "description": "unevaluatedProperties with dependentSchemas",
645 "schema": {
646 "$schema": "https://json-schema.org/v1",
647 "type": "object",
648 "properties": {
649 "foo": { "type": "string" }
650 },
651 "dependentSchemas": {
652 "foo": {
653 "properties": {
654 "bar": { "const": "bar" }
655 },
656 "required": ["bar"]
657 }
658 },
659 "unevaluatedProperties": false
660 },
661 "tests": [
662 {
663 "description": "with no unevaluated properties",
664 "data": {
665 "foo": "foo",
666 "bar": "bar"
667 },
668 "valid": true
669 },
670 {
671 "description": "with unevaluated properties",
672 "data": {
673 "bar": "bar"
674 },
675 "valid": false
676 }
677 ]
678 },
679 {
680 "description": "unevaluatedProperties with boolean schemas",
681 "schema": {
682 "$schema": "https://json-schema.org/v1",
683 "type": "object",
684 "properties": {
685 "foo": { "type": "string" }
686 },
687 "allOf": [true],
688 "unevaluatedProperties": false
689 },
690 "tests": [
691 {
692 "description": "with no unevaluated properties",
693 "data": {
694 "foo": "foo"
695 },
696 "valid": true
697 },
698 {
699 "description": "with unevaluated properties",
700 "data": {
701 "bar": "bar"
702 },
703 "valid": false
704 }
705 ]
706 },
707 {
708 "description": "unevaluatedProperties with $ref",
709 "schema": {
710 "$schema": "https://json-schema.org/v1",
711 "type": "object",
712 "$ref": "#/$defs/bar",
713 "properties": {
714 "foo": { "type": "string" }
715 },
716 "unevaluatedProperties": false,
717 "$defs": {
718 "bar": {
719 "properties": {
720 "bar": { "type": "string" }
721 }
722 }
723 }
724 },
725 "tests": [
726 {
727 "description": "with no unevaluated properties",
728 "data": {
729 "foo": "foo",
730 "bar": "bar"
731 },
732 "valid": true
733 },
734 {
735 "description": "with unevaluated properties",
736 "data": {
737 "foo": "foo",
738 "bar": "bar",
739 "baz": "baz"
740 },
741 "valid": false
742 }
743 ]
744 },
745 {
746 "description": "unevaluatedProperties before $ref",
747 "schema": {
748 "$schema": "https://json-schema.org/v1",
749 "type": "object",
750 "unevaluatedProperties": false,
751 "properties": {
752 "foo": { "type": "string" }
753 },
754 "$ref": "#/$defs/bar",
755 "$defs": {
756 "bar": {
757 "properties": {
758 "bar": { "type": "string" }
759 }
760 }
761 }
762 },
763 "tests": [
764 {
765 "description": "with no unevaluated properties",
766 "data": {
767 "foo": "foo",
768 "bar": "bar"
769 },
770 "valid": true
771 },
772 {
773 "description": "with unevaluated properties",
774 "data": {
775 "foo": "foo",
776 "bar": "bar",
777 "baz": "baz"
778 },
779 "valid": false
780 }
781 ]
782 },
783 {
784 "description": "unevaluatedProperties with $dynamicRef",
785 "schema": {
786 "$schema": "https://json-schema.org/v1",
787 "$id": "https://example.com/unevaluated-properties-with-dynamic-ref/derived",
788
789 "$ref": "./baseSchema",
790
791 "$defs": {
792 "derived": {
793 "$dynamicAnchor": "addons",
794 "properties": {
795 "bar": { "type": "string" }
796 }
797 },
798 "baseSchema": {
799 "$id": "./baseSchema",
800
801 "$comment": "unevaluatedProperties comes first so it's more likely to catch bugs with implementations that are sensitive to keyword ordering",
802 "unevaluatedProperties": false,
803 "type": "object",
804 "properties": {
805 "foo": { "type": "string" }
806 },
807 "$dynamicRef": "#addons"
808 }
809 }
810 },
811 "tests": [
812 {
813 "description": "with no unevaluated properties",
814 "data": {
815 "foo": "foo",
816 "bar": "bar"
817 },
818 "valid": true
819 },
820 {
821 "description": "with unevaluated properties",
822 "data": {
823 "foo": "foo",
824 "bar": "bar",
825 "baz": "baz"
826 },
827 "valid": false
828 }
829 ]
830 },
831 {
832 "description": "unevaluatedProperties can't see inside cousins",
833 "schema": {
834 "$schema": "https://json-schema.org/v1",
835 "allOf": [
836 {
837 "properties": {
838 "foo": true
839 }
840 },
841 {
842 "unevaluatedProperties": false
843 }
844 ]
845 },
846 "tests": [
847 {
848 "description": "always fails",
849 "data": {
850 "foo": 1
851 },
852 "valid": false
853 }
854 ]
855 },
856 {
857 "description": "unevaluatedProperties can't see inside cousins (reverse order)",
858 "schema": {
859 "$schema": "https://json-schema.org/v1",
860 "allOf": [
861 {
862 "unevaluatedProperties": false
863 },
864 {
865 "properties": {
866 "foo": true
867 }
868 }
869 ]
870 },
871 "tests": [
872 {
873 "description": "always fails",
874 "data": {
875 "foo": 1
876 },
877 "valid": false
878 }
879 ]
880 },
881 {
882 "description": "nested unevaluatedProperties, outer false, inner true, properties outside",
883 "schema": {
884 "$schema": "https://json-schema.org/v1",
885 "type": "object",
886 "properties": {
887 "foo": { "type": "string" }
888 },
889 "allOf": [
890 {
891 "unevaluatedProperties": true
892 }
893 ],
894 "unevaluatedProperties": false
895 },
896 "tests": [
897 {
898 "description": "with no nested unevaluated properties",
899 "data": {
900 "foo": "foo"
901 },
902 "valid": true
903 },
904 {
905 "description": "with nested unevaluated properties",
906 "data": {
907 "foo": "foo",
908 "bar": "bar"
909 },
910 "valid": true
911 }
912 ]
913 },
914 {
915 "description": "nested unevaluatedProperties, outer false, inner true, properties inside",
916 "schema": {
917 "$schema": "https://json-schema.org/v1",
918 "type": "object",
919 "allOf": [
920 {
921 "properties": {
922 "foo": { "type": "string" }
923 },
924 "unevaluatedProperties": true
925 }
926 ],
927 "unevaluatedProperties": false
928 },
929 "tests": [
930 {
931 "description": "with no nested unevaluated properties",
932 "data": {
933 "foo": "foo"
934 },
935 "valid": true
936 },
937 {
938 "description": "with nested unevaluated properties",
939 "data": {
940 "foo": "foo",
941 "bar": "bar"
942 },
943 "valid": true
944 }
945 ]
946 },
947 {
948 "description": "nested unevaluatedProperties, outer true, inner false, properties outside",
949 "schema": {
950 "$schema": "https://json-schema.org/v1",
951 "type": "object",
952 "properties": {
953 "foo": { "type": "string" }
954 },
955 "allOf": [
956 {
957 "unevaluatedProperties": false
958 }
959 ],
960 "unevaluatedProperties": true
961 },
962 "tests": [
963 {
964 "description": "with no nested unevaluated properties",
965 "data": {
966 "foo": "foo"
967 },
968 "valid": false
969 },
970 {
971 "description": "with nested unevaluated properties",
972 "data": {
973 "foo": "foo",
974 "bar": "bar"
975 },
976 "valid": false
977 }
978 ]
979 },
980 {
981 "description": "nested unevaluatedProperties, outer true, inner false, properties inside",
982 "schema": {
983 "$schema": "https://json-schema.org/v1",
984 "type": "object",
985 "allOf": [
986 {
987 "properties": {
988 "foo": { "type": "string" }
989 },
990 "unevaluatedProperties": false
991 }
992 ],
993 "unevaluatedProperties": true
994 },
995 "tests": [
996 {
997 "description": "with no nested unevaluated properties",
998 "data": {
999 "foo": "foo"
1000 },
1001 "valid": true
1002 },
1003 {
1004 "description": "with nested unevaluated properties",
1005 "data": {
1006 "foo": "foo",
1007 "bar": "bar"
1008 },
1009 "valid": false
1010 }
1011 ]
1012 },
1013 {
1014 "description": "cousin unevaluatedProperties, true and false, true with properties",
1015 "schema": {
1016 "$schema": "https://json-schema.org/v1",
1017 "type": "object",
1018 "allOf": [
1019 {
1020 "properties": {
1021 "foo": { "type": "string" }
1022 },
1023 "unevaluatedProperties": true
1024 },
1025 {
1026 "unevaluatedProperties": false
1027 }
1028 ]
1029 },
1030 "tests": [
1031 {
1032 "description": "with no nested unevaluated properties",
1033 "data": {
1034 "foo": "foo"
1035 },
1036 "valid": false
1037 },
1038 {
1039 "description": "with nested unevaluated properties",
1040 "data": {
1041 "foo": "foo",
1042 "bar": "bar"
1043 },
1044 "valid": false
1045 }
1046 ]
1047 },
1048 {
1049 "description": "cousin unevaluatedProperties, true and false, false with properties",
1050 "schema": {
1051 "$schema": "https://json-schema.org/v1",
1052 "type": "object",
1053 "allOf": [
1054 {
1055 "unevaluatedProperties": true
1056 },
1057 {
1058 "properties": {
1059 "foo": { "type": "string" }
1060 },
1061 "unevaluatedProperties": false
1062 }
1063 ]
1064 },
1065 "tests": [
1066 {
1067 "description": "with no nested unevaluated properties",
1068 "data": {
1069 "foo": "foo"
1070 },
1071 "valid": true
1072 },
1073 {
1074 "description": "with nested unevaluated properties",
1075 "data": {
1076 "foo": "foo",
1077 "bar": "bar"
1078 },
1079 "valid": false
1080 }
1081 ]
1082 },
1083 {
1084 "description": "property is evaluated in an uncle schema to unevaluatedProperties",
1085 "comment": "see https://stackoverflow.com/questions/66936884/deeply-nested-unevaluatedproperties-and-their-expectations",
1086 "schema": {
1087 "$schema": "https://json-schema.org/v1",
1088 "type": "object",
1089 "properties": {
1090 "foo": {
1091 "type": "object",
1092 "properties": {
1093 "bar": {
1094 "type": "string"
1095 }
1096 },
1097 "unevaluatedProperties": false
1098 }
1099 },
1100 "anyOf": [
1101 {
1102 "properties": {
1103 "foo": {
1104 "properties": {
1105 "faz": {
1106 "type": "string"
1107 }
1108 }
1109 }
1110 }
1111 }
1112 ]
1113 },
1114 "tests": [
1115 {
1116 "description": "no extra properties",
1117 "data": {
1118 "foo": {
1119 "bar": "test"
1120 }
1121 },
1122 "valid": true
1123 },
1124 {
1125 "description": "uncle keyword evaluation is not significant",
1126 "data": {
1127 "foo": {
1128 "bar": "test",
1129 "faz": "test"
1130 }
1131 },
1132 "valid": false
1133 }
1134 ]
1135 },
1136 {
1137 "description": "in-place applicator siblings, allOf has unevaluated",
1138 "schema": {
1139 "$schema": "https://json-schema.org/v1",
1140 "type": "object",
1141 "allOf": [
1142 {
1143 "properties": {
1144 "foo": true
1145 },
1146 "unevaluatedProperties": false
1147 }
1148 ],
1149 "anyOf": [
1150 {
1151 "properties": {
1152 "bar": true
1153 }
1154 }
1155 ]
1156 },
1157 "tests": [
1158 {
1159 "description": "base case: both properties present",
1160 "data": {
1161 "foo": 1,
1162 "bar": 1
1163 },
1164 "valid": false
1165 },
1166 {
1167 "description": "in place applicator siblings, bar is missing",
1168 "data": {
1169 "foo": 1
1170 },
1171 "valid": true
1172 },
1173 {
1174 "description": "in place applicator siblings, foo is missing",
1175 "data": {
1176 "bar": 1
1177 },
1178 "valid": false
1179 }
1180 ]
1181 },
1182 {
1183 "description": "in-place applicator siblings, anyOf has unevaluated",
1184 "schema": {
1185 "$schema": "https://json-schema.org/v1",
1186 "type": "object",
1187 "allOf": [
1188 {
1189 "properties": {
1190 "foo": true
1191 }
1192 }
1193 ],
1194 "anyOf": [
1195 {
1196 "properties": {
1197 "bar": true
1198 },
1199 "unevaluatedProperties": false
1200 }
1201 ]
1202 },
1203 "tests": [
1204 {
1205 "description": "base case: both properties present",
1206 "data": {
1207 "foo": 1,
1208 "bar": 1
1209 },
1210 "valid": false
1211 },
1212 {
1213 "description": "in place applicator siblings, bar is missing",
1214 "data": {
1215 "foo": 1
1216 },
1217 "valid": false
1218 },
1219 {
1220 "description": "in place applicator siblings, foo is missing",
1221 "data": {
1222 "bar": 1
1223 },
1224 "valid": true
1225 }
1226 ]
1227 },
1228 {
1229 "description": "unevaluatedProperties + single cyclic ref",
1230 "schema": {
1231 "$schema": "https://json-schema.org/v1",
1232 "type": "object",
1233 "properties": {
1234 "x": { "$ref": "#" }
1235 },
1236 "unevaluatedProperties": false
1237 },
1238 "tests": [
1239 {
1240 "description": "Empty is valid",
1241 "data": {},
1242 "valid": true
1243 },
1244 {
1245 "description": "Single is valid",
1246 "data": { "x": {} },
1247 "valid": true
1248 },
1249 {
1250 "description": "Unevaluated on 1st level is invalid",
1251 "data": { "x": {}, "y": {} },
1252 "valid": false
1253 },
1254 {
1255 "description": "Nested is valid",
1256 "data": { "x": { "x": {} } },
1257 "valid": true
1258 },
1259 {
1260 "description": "Unevaluated on 2nd level is invalid",
1261 "data": { "x": { "x": {}, "y": {} } },
1262 "valid": false
1263 },
1264 {
1265 "description": "Deep nested is valid",
1266 "data": { "x": { "x": { "x": {} } } },
1267 "valid": true
1268 },
1269 {
1270 "description": "Unevaluated on 3rd level is invalid",
1271 "data": { "x": { "x": { "x": {}, "y": {} } } },
1272 "valid": false
1273 }
1274 ]
1275 },
1276 {
1277 "description": "unevaluatedProperties + ref inside allOf / oneOf",
1278 "schema": {
1279 "$schema": "https://json-schema.org/v1",
1280 "$defs": {
1281 "one": {
1282 "properties": { "a": true }
1283 },
1284 "two": {
1285 "required": ["x"],
1286 "properties": { "x": true }
1287 }
1288 },
1289 "allOf": [
1290 { "$ref": "#/$defs/one" },
1291 { "properties": { "b": true } },
1292 {
1293 "oneOf": [
1294 { "$ref": "#/$defs/two" },
1295 {
1296 "required": ["y"],
1297 "properties": { "y": true }
1298 }
1299 ]
1300 }
1301 ],
1302 "unevaluatedProperties": false
1303 },
1304 "tests": [
1305 {
1306 "description": "Empty is invalid (no x or y)",
1307 "data": {},
1308 "valid": false
1309 },
1310 {
1311 "description": "a and b are invalid (no x or y)",
1312 "data": { "a": 1, "b": 1 },
1313 "valid": false
1314 },
1315 {
1316 "description": "x and y are invalid",
1317 "data": { "x": 1, "y": 1 },
1318 "valid": false
1319 },
1320 {
1321 "description": "a and x are valid",
1322 "data": { "a": 1, "x": 1 },
1323 "valid": true
1324 },
1325 {
1326 "description": "a and y are valid",
1327 "data": { "a": 1, "y": 1 },
1328 "valid": true
1329 },
1330 {
1331 "description": "a and b and x are valid",
1332 "data": { "a": 1, "b": 1, "x": 1 },
1333 "valid": true
1334 },
1335 {
1336 "description": "a and b and y are valid",
1337 "data": { "a": 1, "b": 1, "y": 1 },
1338 "valid": true
1339 },
1340 {
1341 "description": "a and b and x and y are invalid",
1342 "data": { "a": 1, "b": 1, "x": 1, "y": 1 },
1343 "valid": false
1344 }
1345 ]
1346 },
1347 {
1348 "description": "dynamic evaluation inside nested refs",
1349 "schema": {
1350 "$schema": "https://json-schema.org/v1",
1351 "$defs": {
1352 "one": {
1353 "oneOf": [
1354 { "$ref": "#/$defs/two" },
1355 { "required": ["b"], "properties": { "b": true } },
1356 { "required": ["xx"], "patternProperties": { "x": true } },
1357 { "required": ["all"], "unevaluatedProperties": true }
1358 ]
1359 },
1360 "two": {
1361 "oneOf": [
1362 { "required": ["c"], "properties": { "c": true } },
1363 { "required": ["d"], "properties": { "d": true } }
1364 ]
1365 }
1366 },
1367 "oneOf": [
1368 { "$ref": "#/$defs/one" },
1369 { "required": ["a"], "properties": { "a": true } }
1370 ],
1371 "unevaluatedProperties": false
1372 },
1373 "tests": [
1374 {
1375 "description": "Empty is invalid",
1376 "data": {},
1377 "valid": false
1378 },
1379 {
1380 "description": "a is valid",
1381 "data": { "a": 1 },
1382 "valid": true
1383 },
1384 {
1385 "description": "b is valid",
1386 "data": { "b": 1 },
1387 "valid": true
1388 },
1389 {
1390 "description": "c is valid",
1391 "data": { "c": 1 },
1392 "valid": true
1393 },
1394 {
1395 "description": "d is valid",
1396 "data": { "d": 1 },
1397 "valid": true
1398 },
1399 {
1400 "description": "a + b is invalid",
1401 "data": { "a": 1, "b": 1 },
1402 "valid": false
1403 },
1404 {
1405 "description": "a + c is invalid",
1406 "data": { "a": 1, "c": 1 },
1407 "valid": false
1408 },
1409 {
1410 "description": "a + d is invalid",
1411 "data": { "a": 1, "d": 1 },
1412 "valid": false
1413 },
1414 {
1415 "description": "b + c is invalid",
1416 "data": { "b": 1, "c": 1 },
1417 "valid": false
1418 },
1419 {
1420 "description": "b + d is invalid",
1421 "data": { "b": 1, "d": 1 },
1422 "valid": false
1423 },
1424 {
1425 "description": "c + d is invalid",
1426 "data": { "c": 1, "d": 1 },
1427 "valid": false
1428 },
1429 {
1430 "description": "xx is valid",
1431 "data": { "xx": 1 },
1432 "valid": true
1433 },
1434 {
1435 "description": "xx + foox is valid",
1436 "data": { "xx": 1, "foox": 1 },
1437 "valid": true
1438 },
1439 {
1440 "description": "xx + foo is invalid",
1441 "data": { "xx": 1, "foo": 1 },
1442 "valid": false
1443 },
1444 {
1445 "description": "xx + a is invalid",
1446 "data": { "xx": 1, "a": 1 },
1447 "valid": false
1448 },
1449 {
1450 "description": "xx + b is invalid",
1451 "data": { "xx": 1, "b": 1 },
1452 "valid": false
1453 },
1454 {
1455 "description": "xx + c is invalid",
1456 "data": { "xx": 1, "c": 1 },
1457 "valid": false
1458 },
1459 {
1460 "description": "xx + d is invalid",
1461 "data": { "xx": 1, "d": 1 },
1462 "valid": false
1463 },
1464 {
1465 "description": "all is valid",
1466 "data": { "all": 1 },
1467 "valid": true
1468 },
1469 {
1470 "description": "all + foo is valid",
1471 "data": { "all": 1, "foo": 1 },
1472 "valid": true
1473 },
1474 {
1475 "description": "all + a is invalid",
1476 "data": { "all": 1, "a": 1 },
1477 "valid": false
1478 }
1479 ]
1480 },
1481 {
1482 "description": "non-object instances are valid",
1483 "schema": {
1484 "$schema": "https://json-schema.org/v1",
1485 "unevaluatedProperties": false
1486 },
1487 "tests": [
1488 {
1489 "description": "ignores booleans",
1490 "data": true,
1491 "valid": true
1492 },
1493 {
1494 "description": "ignores integers",
1495 "data": 123,
1496 "valid": true
1497 },
1498 {
1499 "description": "ignores floats",
1500 "data": 1.0,
1501 "valid": true
1502 },
1503 {
1504 "description": "ignores arrays",
1505 "data": [],
1506 "valid": true
1507 },
1508 {
1509 "description": "ignores strings",
1510 "data": "foo",
1511 "valid": true
1512 },
1513 {
1514 "description": "ignores null",
1515 "data": null,
1516 "valid": true
1517 }
1518 ]
1519 },
1520 {
1521 "description": "unevaluatedProperties with null valued instance properties",
1522 "schema": {
1523 "$schema": "https://json-schema.org/v1",
1524 "unevaluatedProperties": {
1525 "type": "null"
1526 }
1527 },
1528 "tests": [
1529 {
1530 "description": "allows null valued properties",
1531 "data": {"foo": null},
1532 "valid": true
1533 }
1534 ]
1535 },
1536 {
1537 "description": "unevaluatedProperties not affected by propertyNames",
1538 "schema": {
1539 "$schema": "https://json-schema.org/v1",
1540 "propertyNames": {"maxLength": 1},
1541 "unevaluatedProperties": {
1542 "type": "number"
1543 }
1544 },
1545 "tests": [
1546 {
1547 "description": "allows only number properties",
1548 "data": {"a": 1},
1549 "valid": true
1550 },
1551 {
1552 "description": "string property is invalid",
1553 "data": {"a": "b"},
1554 "valid": false
1555 }
1556 ]
1557 },
1558 {
1559 "description": "unevaluatedProperties can see annotations from if without then and else",
1560 "schema": {
1561 "$schema": "https://json-schema.org/v1",
1562 "if": {
1563 "patternProperties": {
1564 "foo": {
1565 "type": "string"
1566 }
1567 }
1568 },
1569 "unevaluatedProperties": false
1570 },
1571 "tests": [
1572 {
1573 "description": "valid in case if is evaluated",
1574 "data": {
1575 "foo": "a"
1576 },
1577 "valid": true
1578 },
1579 {
1580 "description": "invalid in case if is evaluated",
1581 "data": {
1582 "bar": "a"
1583 },
1584 "valid": false
1585 }
1586 ]
1587 },
1588 {
1589 "description": "dependentSchemas with unevaluatedProperties",
1590 "schema": {
1591 "$schema": "https://json-schema.org/v1",
1592 "properties": {"foo2": {}},
1593 "dependentSchemas": {
1594 "foo" : {},
1595 "foo2": {
1596 "properties": {
1597 "bar":{}
1598 }
1599 }
1600 },
1601 "unevaluatedProperties": false
1602 },
1603 "tests": [
1604 {
1605 "description": "unevaluatedProperties doesn't consider dependentSchemas",
1606 "data": {"foo": ""},
1607 "valid": false
1608 },
1609 {
1610 "description": "unevaluatedProperties doesn't see bar when foo2 is absent",
1611 "data": {"bar": ""},
1612 "valid": false
1613 },
1614 {
1615 "description": "unevaluatedProperties sees bar when foo2 is present",
1616 "data": {"foo2": "", "bar": ""},
1617 "valid": true
1618 }
1619 ]
1620 },
1621 {
1622 "description": "Evaluated properties collection needs to consider instance location",
1623 "schema": {
1624 "$schema": "https://json-schema.org/v1",
1625 "properties": {
1626 "foo": {
1627 "properties": {
1628 "bar": { "type": "string" }
1629 }
1630 }
1631 },
1632 "unevaluatedProperties": false
1633 },
1634 "tests": [
1635 {
1636 "description": "with an unevaluated property that exists at another location",
1637 "data": {
1638 "foo": { "bar": "foo" },
1639 "bar": "bar"
1640 },
1641 "valid": false
1642 }
1643 ]
1644 },
1645 {
1646 "description": "Evaluated properties collection needs to consider instance location with patternProperties",
1647 "schema": {
1648 "$schema": "https://json-schema.org/v1",
1649 "properties": {
1650 "foo": {
1651 "patternProperties": {
1652 "^bar$": { "type": "string" }
1653 }
1654 }
1655 },
1656 "unevaluatedProperties": false
1657 },
1658 "tests": [
1659 {
1660 "description": "with only the nested evaluated property",
1661 "data": {
1662 "foo": { "bar": "foo" }
1663 },
1664 "valid": true
1665 },
1666 {
1667 "description": "with an unevaluated property that exists at another location",
1668 "data": {
1669 "foo": { "bar": "foo" },
1670 "bar": "bar"
1671 },
1672 "valid": false
1673 }
1674 ]
1675 },
1676 {
1677 "description": "Evaluated properties collection needs to consider instance location with additionalProperties",
1678 "schema": {
1679 "$schema": "https://json-schema.org/v1",
1680 "properties": {
1681 "foo": {
1682 "additionalProperties": { "type": "string" }
1683 }
1684 },
1685 "unevaluatedProperties": false
1686 },
1687 "tests": [
1688 {
1689 "description": "with only the nested evaluated property",
1690 "data": {
1691 "foo": { "bar": "foo" }
1692 },
1693 "valid": true
1694 },
1695 {
1696 "description": "with an unevaluated property that exists at another location",
1697 "data": {
1698 "foo": { "bar": "foo" },
1699 "bar": "bar"
1700 },
1701 "valid": false
1702 }
1703 ]
1704 }
1705 ]