Debian Codegraph @

share/tests/draft2020-12/unevaluatedProperties.json

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