Debian Codegraph @

share/tests/draft2019-09/unevaluatedProperties.json

raw
1 [
2 {
3 "description": "unevaluatedProperties true",
4 "schema": {
5 "$schema": "https://json-schema.org/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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/draft/2019-09/schema",
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 $recursiveRef",
785 "schema": {
786 "$schema": "https://json-schema.org/draft/2019-09/schema",
787 "$id": "https://example.com/unevaluated-properties-with-recursive-ref/extended-tree",
788
789 "$recursiveAnchor": true,
790
791 "$ref": "./tree",
792 "properties": {
793 "name": { "type": "string" }
794 },
795
796 "$defs": {
797 "tree": {
798 "$id": "./tree",
799 "$recursiveAnchor": true,
800
801 "type": "object",
802 "properties": {
803 "node": true,
804 "branches": {
805 "$comment": "unevaluatedProperties comes first so it's more likely to bugs errors with implementations that are sensitive to keyword ordering",
806 "unevaluatedProperties": false,
807 "$recursiveRef": "#"
808 }
809 },
810 "required": ["node"]
811 }
812 }
813 },
814 "tests": [
815 {
816 "description": "with no unevaluated properties",
817 "data": {
818 "name": "a",
819 "node": 1,
820 "branches": {
821 "name": "b",
822 "node": 2
823 }
824 },
825 "valid": true
826 },
827 {
828 "description": "with unevaluated properties",
829 "data": {
830 "name": "a",
831 "node": 1,
832 "branches": {
833 "foo": "b",
834 "node": 2
835 }
836 },
837 "valid": false
838 }
839 ]
840 },
841 {
842 "description": "unevaluatedProperties can't see inside cousins",
843 "schema": {
844 "$schema": "https://json-schema.org/draft/2019-09/schema",
845 "allOf": [
846 {
847 "properties": {
848 "foo": true
849 }
850 },
851 {
852 "unevaluatedProperties": false
853 }
854 ]
855 },
856 "tests": [
857 {
858 "description": "always fails",
859 "data": {
860 "foo": 1
861 },
862 "valid": false
863 }
864 ]
865 },
866 {
867 "description": "unevaluatedProperties can't see inside cousins (reverse order)",
868 "schema": {
869 "$schema": "https://json-schema.org/draft/2019-09/schema",
870 "allOf": [
871 {
872 "unevaluatedProperties": false
873 },
874 {
875 "properties": {
876 "foo": true
877 }
878 }
879 ]
880 },
881 "tests": [
882 {
883 "description": "always fails",
884 "data": {
885 "foo": 1
886 },
887 "valid": false
888 }
889 ]
890 },
891 {
892 "description": "nested unevaluatedProperties, outer false, inner true, properties outside",
893 "schema": {
894 "$schema": "https://json-schema.org/draft/2019-09/schema",
895 "type": "object",
896 "properties": {
897 "foo": { "type": "string" }
898 },
899 "allOf": [
900 {
901 "unevaluatedProperties": true
902 }
903 ],
904 "unevaluatedProperties": false
905 },
906 "tests": [
907 {
908 "description": "with no nested unevaluated properties",
909 "data": {
910 "foo": "foo"
911 },
912 "valid": true
913 },
914 {
915 "description": "with nested unevaluated properties",
916 "data": {
917 "foo": "foo",
918 "bar": "bar"
919 },
920 "valid": true
921 }
922 ]
923 },
924 {
925 "description": "nested unevaluatedProperties, outer false, inner true, properties inside",
926 "schema": {
927 "$schema": "https://json-schema.org/draft/2019-09/schema",
928 "type": "object",
929 "allOf": [
930 {
931 "properties": {
932 "foo": { "type": "string" }
933 },
934 "unevaluatedProperties": true
935 }
936 ],
937 "unevaluatedProperties": false
938 },
939 "tests": [
940 {
941 "description": "with no nested unevaluated properties",
942 "data": {
943 "foo": "foo"
944 },
945 "valid": true
946 },
947 {
948 "description": "with nested unevaluated properties",
949 "data": {
950 "foo": "foo",
951 "bar": "bar"
952 },
953 "valid": true
954 }
955 ]
956 },
957 {
958 "description": "nested unevaluatedProperties, outer true, inner false, properties outside",
959 "schema": {
960 "$schema": "https://json-schema.org/draft/2019-09/schema",
961 "type": "object",
962 "properties": {
963 "foo": { "type": "string" }
964 },
965 "allOf": [
966 {
967 "unevaluatedProperties": false
968 }
969 ],
970 "unevaluatedProperties": true
971 },
972 "tests": [
973 {
974 "description": "with no nested unevaluated properties",
975 "data": {
976 "foo": "foo"
977 },
978 "valid": false
979 },
980 {
981 "description": "with nested unevaluated properties",
982 "data": {
983 "foo": "foo",
984 "bar": "bar"
985 },
986 "valid": false
987 }
988 ]
989 },
990 {
991 "description": "nested unevaluatedProperties, outer true, inner false, properties inside",
992 "schema": {
993 "$schema": "https://json-schema.org/draft/2019-09/schema",
994 "type": "object",
995 "allOf": [
996 {
997 "properties": {
998 "foo": { "type": "string" }
999 },
1000 "unevaluatedProperties": false
1001 }
1002 ],
1003 "unevaluatedProperties": true
1004 },
1005 "tests": [
1006 {
1007 "description": "with no nested unevaluated properties",
1008 "data": {
1009 "foo": "foo"
1010 },
1011 "valid": true
1012 },
1013 {
1014 "description": "with nested unevaluated properties",
1015 "data": {
1016 "foo": "foo",
1017 "bar": "bar"
1018 },
1019 "valid": false
1020 }
1021 ]
1022 },
1023 {
1024 "description": "cousin unevaluatedProperties, true and false, true with properties",
1025 "schema": {
1026 "$schema": "https://json-schema.org/draft/2019-09/schema",
1027 "type": "object",
1028 "allOf": [
1029 {
1030 "properties": {
1031 "foo": { "type": "string" }
1032 },
1033 "unevaluatedProperties": true
1034 },
1035 {
1036 "unevaluatedProperties": false
1037 }
1038 ]
1039 },
1040 "tests": [
1041 {
1042 "description": "with no nested unevaluated properties",
1043 "data": {
1044 "foo": "foo"
1045 },
1046 "valid": false
1047 },
1048 {
1049 "description": "with nested unevaluated properties",
1050 "data": {
1051 "foo": "foo",
1052 "bar": "bar"
1053 },
1054 "valid": false
1055 }
1056 ]
1057 },
1058 {
1059 "description": "cousin unevaluatedProperties, true and false, false with properties",
1060 "schema": {
1061 "$schema": "https://json-schema.org/draft/2019-09/schema",
1062 "type": "object",
1063 "allOf": [
1064 {
1065 "unevaluatedProperties": true
1066 },
1067 {
1068 "properties": {
1069 "foo": { "type": "string" }
1070 },
1071 "unevaluatedProperties": false
1072 }
1073 ]
1074 },
1075 "tests": [
1076 {
1077 "description": "with no nested unevaluated properties",
1078 "data": {
1079 "foo": "foo"
1080 },
1081 "valid": true
1082 },
1083 {
1084 "description": "with nested unevaluated properties",
1085 "data": {
1086 "foo": "foo",
1087 "bar": "bar"
1088 },
1089 "valid": false
1090 }
1091 ]
1092 },
1093 {
1094 "description": "property is evaluated in an uncle schema to unevaluatedProperties",
1095 "comment": "see https://stackoverflow.com/questions/66936884/deeply-nested-unevaluatedproperties-and-their-expectations",
1096 "schema": {
1097 "$schema": "https://json-schema.org/draft/2019-09/schema",
1098 "type": "object",
1099 "properties": {
1100 "foo": {
1101 "type": "object",
1102 "properties": {
1103 "bar": {
1104 "type": "string"
1105 }
1106 },
1107 "unevaluatedProperties": false
1108 }
1109 },
1110 "anyOf": [
1111 {
1112 "properties": {
1113 "foo": {
1114 "properties": {
1115 "faz": {
1116 "type": "string"
1117 }
1118 }
1119 }
1120 }
1121 }
1122 ]
1123 },
1124 "tests": [
1125 {
1126 "description": "no extra properties",
1127 "data": {
1128 "foo": {
1129 "bar": "test"
1130 }
1131 },
1132 "valid": true
1133 },
1134 {
1135 "description": "uncle keyword evaluation is not significant",
1136 "data": {
1137 "foo": {
1138 "bar": "test",
1139 "faz": "test"
1140 }
1141 },
1142 "valid": false
1143 }
1144 ]
1145 },
1146 {
1147 "description": "in-place applicator siblings, allOf has unevaluated",
1148 "schema": {
1149 "$schema": "https://json-schema.org/draft/2019-09/schema",
1150 "type": "object",
1151 "allOf": [
1152 {
1153 "properties": {
1154 "foo": true
1155 },
1156 "unevaluatedProperties": false
1157 }
1158 ],
1159 "anyOf": [
1160 {
1161 "properties": {
1162 "bar": true
1163 }
1164 }
1165 ]
1166 },
1167 "tests": [
1168 {
1169 "description": "base case: both properties present",
1170 "data": {
1171 "foo": 1,
1172 "bar": 1
1173 },
1174 "valid": false
1175 },
1176 {
1177 "description": "in place applicator siblings, bar is missing",
1178 "data": {
1179 "foo": 1
1180 },
1181 "valid": true
1182 },
1183 {
1184 "description": "in place applicator siblings, foo is missing",
1185 "data": {
1186 "bar": 1
1187 },
1188 "valid": false
1189 }
1190 ]
1191 },
1192 {
1193 "description": "in-place applicator siblings, anyOf has unevaluated",
1194 "schema": {
1195 "$schema": "https://json-schema.org/draft/2019-09/schema",
1196 "type": "object",
1197 "allOf": [
1198 {
1199 "properties": {
1200 "foo": true
1201 }
1202 }
1203 ],
1204 "anyOf": [
1205 {
1206 "properties": {
1207 "bar": true
1208 },
1209 "unevaluatedProperties": false
1210 }
1211 ]
1212 },
1213 "tests": [
1214 {
1215 "description": "base case: both properties present",
1216 "data": {
1217 "foo": 1,
1218 "bar": 1
1219 },
1220 "valid": false
1221 },
1222 {
1223 "description": "in place applicator siblings, bar is missing",
1224 "data": {
1225 "foo": 1
1226 },
1227 "valid": false
1228 },
1229 {
1230 "description": "in place applicator siblings, foo is missing",
1231 "data": {
1232 "bar": 1
1233 },
1234 "valid": true
1235 }
1236 ]
1237 },
1238 {
1239 "description": "unevaluatedProperties + single cyclic ref",
1240 "schema": {
1241 "$schema": "https://json-schema.org/draft/2019-09/schema",
1242 "type": "object",
1243 "properties": {
1244 "x": { "$ref": "#" }
1245 },
1246 "unevaluatedProperties": false
1247 },
1248 "tests": [
1249 {
1250 "description": "Empty is valid",
1251 "data": {},
1252 "valid": true
1253 },
1254 {
1255 "description": "Single is valid",
1256 "data": { "x": {} },
1257 "valid": true
1258 },
1259 {
1260 "description": "Unevaluated on 1st level is invalid",
1261 "data": { "x": {}, "y": {} },
1262 "valid": false
1263 },
1264 {
1265 "description": "Nested is valid",
1266 "data": { "x": { "x": {} } },
1267 "valid": true
1268 },
1269 {
1270 "description": "Unevaluated on 2nd level is invalid",
1271 "data": { "x": { "x": {}, "y": {} } },
1272 "valid": false
1273 },
1274 {
1275 "description": "Deep nested is valid",
1276 "data": { "x": { "x": { "x": {} } } },
1277 "valid": true
1278 },
1279 {
1280 "description": "Unevaluated on 3rd level is invalid",
1281 "data": { "x": { "x": { "x": {}, "y": {} } } },
1282 "valid": false
1283 }
1284 ]
1285 },
1286 {
1287 "description": "unevaluatedProperties + ref inside allOf / oneOf",
1288 "schema": {
1289 "$schema": "https://json-schema.org/draft/2019-09/schema",
1290 "$defs": {
1291 "one": {
1292 "properties": { "a": true }
1293 },
1294 "two": {
1295 "required": ["x"],
1296 "properties": { "x": true }
1297 }
1298 },
1299 "allOf": [
1300 { "$ref": "#/$defs/one" },
1301 { "properties": { "b": true } },
1302 {
1303 "oneOf": [
1304 { "$ref": "#/$defs/two" },
1305 {
1306 "required": ["y"],
1307 "properties": { "y": true }
1308 }
1309 ]
1310 }
1311 ],
1312 "unevaluatedProperties": false
1313 },
1314 "tests": [
1315 {
1316 "description": "Empty is invalid (no x or y)",
1317 "data": {},
1318 "valid": false
1319 },
1320 {
1321 "description": "a and b are invalid (no x or y)",
1322 "data": { "a": 1, "b": 1 },
1323 "valid": false
1324 },
1325 {
1326 "description": "x and y are invalid",
1327 "data": { "x": 1, "y": 1 },
1328 "valid": false
1329 },
1330 {
1331 "description": "a and x are valid",
1332 "data": { "a": 1, "x": 1 },
1333 "valid": true
1334 },
1335 {
1336 "description": "a and y are valid",
1337 "data": { "a": 1, "y": 1 },
1338 "valid": true
1339 },
1340 {
1341 "description": "a and b and x are valid",
1342 "data": { "a": 1, "b": 1, "x": 1 },
1343 "valid": true
1344 },
1345 {
1346 "description": "a and b and y are valid",
1347 "data": { "a": 1, "b": 1, "y": 1 },
1348 "valid": true
1349 },
1350 {
1351 "description": "a and b and x and y are invalid",
1352 "data": { "a": 1, "b": 1, "x": 1, "y": 1 },
1353 "valid": false
1354 }
1355 ]
1356 },
1357 {
1358 "description": "dynamic evalation inside nested refs",
1359 "schema": {
1360 "$schema": "https://json-schema.org/draft/2019-09/schema",
1361 "$defs": {
1362 "one": {
1363 "oneOf": [
1364 { "$ref": "#/$defs/two" },
1365 { "required": ["b"], "properties": { "b": true } },
1366 { "required": ["xx"], "patternProperties": { "x": true } },
1367 { "required": ["all"], "unevaluatedProperties": true }
1368 ]
1369 },
1370 "two": {
1371 "oneOf": [
1372 { "required": ["c"], "properties": { "c": true } },
1373 { "required": ["d"], "properties": { "d": true } }
1374 ]
1375 }
1376 },
1377 "oneOf": [
1378 { "$ref": "#/$defs/one" },
1379 { "required": ["a"], "properties": { "a": true } }
1380 ],
1381 "unevaluatedProperties": false
1382 },
1383 "tests": [
1384 {
1385 "description": "Empty is invalid",
1386 "data": {},
1387 "valid": false
1388 },
1389 {
1390 "description": "a is valid",
1391 "data": { "a": 1 },
1392 "valid": true
1393 },
1394 {
1395 "description": "b is valid",
1396 "data": { "b": 1 },
1397 "valid": true
1398 },
1399 {
1400 "description": "c is valid",
1401 "data": { "c": 1 },
1402 "valid": true
1403 },
1404 {
1405 "description": "d is valid",
1406 "data": { "d": 1 },
1407 "valid": true
1408 },
1409 {
1410 "description": "a + b is invalid",
1411 "data": { "a": 1, "b": 1 },
1412 "valid": false
1413 },
1414 {
1415 "description": "a + c is invalid",
1416 "data": { "a": 1, "c": 1 },
1417 "valid": false
1418 },
1419 {
1420 "description": "a + d is invalid",
1421 "data": { "a": 1, "d": 1 },
1422 "valid": false
1423 },
1424 {
1425 "description": "b + c is invalid",
1426 "data": { "b": 1, "c": 1 },
1427 "valid": false
1428 },
1429 {
1430 "description": "b + d is invalid",
1431 "data": { "b": 1, "d": 1 },
1432 "valid": false
1433 },
1434 {
1435 "description": "c + d is invalid",
1436 "data": { "c": 1, "d": 1 },
1437 "valid": false
1438 },
1439 {
1440 "description": "xx is valid",
1441 "data": { "xx": 1 },
1442 "valid": true
1443 },
1444 {
1445 "description": "xx + foox is valid",
1446 "data": { "xx": 1, "foox": 1 },
1447 "valid": true
1448 },
1449 {
1450 "description": "xx + foo is invalid",
1451 "data": { "xx": 1, "foo": 1 },
1452 "valid": false
1453 },
1454 {
1455 "description": "xx + a is invalid",
1456 "data": { "xx": 1, "a": 1 },
1457 "valid": false
1458 },
1459 {
1460 "description": "xx + b is invalid",
1461 "data": { "xx": 1, "b": 1 },
1462 "valid": false
1463 },
1464 {
1465 "description": "xx + c is invalid",
1466 "data": { "xx": 1, "c": 1 },
1467 "valid": false
1468 },
1469 {
1470 "description": "xx + d is invalid",
1471 "data": { "xx": 1, "d": 1 },
1472 "valid": false
1473 },
1474 {
1475 "description": "all is valid",
1476 "data": { "all": 1 },
1477 "valid": true
1478 },
1479 {
1480 "description": "all + foo is valid",
1481 "data": { "all": 1, "foo": 1 },
1482 "valid": true
1483 },
1484 {
1485 "description": "all + a is invalid",
1486 "data": { "all": 1, "a": 1 },
1487 "valid": false
1488 }
1489 ]
1490 },
1491 {
1492 "description": "non-object instances are valid",
1493 "schema": {
1494 "$schema": "https://json-schema.org/draft/2019-09/schema",
1495 "unevaluatedProperties": false
1496 },
1497 "tests": [
1498 {
1499 "description": "ignores booleans",
1500 "data": true,
1501 "valid": true
1502 },
1503 {
1504 "description": "ignores integers",
1505 "data": 123,
1506 "valid": true
1507 },
1508 {
1509 "description": "ignores floats",
1510 "data": 1.0,
1511 "valid": true
1512 },
1513 {
1514 "description": "ignores arrays",
1515 "data": [],
1516 "valid": true
1517 },
1518 {
1519 "description": "ignores strings",
1520 "data": "foo",
1521 "valid": true
1522 },
1523 {
1524 "description": "ignores null",
1525 "data": null,
1526 "valid": true
1527 }
1528 ]
1529 },
1530 {
1531 "description": "unevaluatedProperties with null valued instance properties",
1532 "schema": {
1533 "$schema": "https://json-schema.org/draft/2019-09/schema",
1534 "unevaluatedProperties": {
1535 "type": "null"
1536 }
1537 },
1538 "tests": [
1539 {
1540 "description": "allows null valued properties",
1541 "data": {"foo": null},
1542 "valid": true
1543 }
1544 ]
1545 },
1546 {
1547 "description": "unevaluatedProperties not affected by propertyNames",
1548 "schema": {
1549 "$schema": "https://json-schema.org/draft/2019-09/schema",
1550 "propertyNames": {"maxLength": 1},
1551 "unevaluatedProperties": {
1552 "type": "number"
1553 }
1554 },
1555 "tests": [
1556 {
1557 "description": "allows only number properties",
1558 "data": {"a": 1},
1559 "valid": true
1560 },
1561 {
1562 "description": "string property is invalid",
1563 "data": {"a": "b"},
1564 "valid": false
1565 }
1566 ]
1567 },
1568 {
1569 "description": "unevaluatedProperties can see annotations from if without then and else",
1570 "schema": {
1571 "$schema": "https://json-schema.org/draft/2019-09/schema",
1572 "if": {
1573 "patternProperties": {
1574 "foo": {
1575 "type": "string"
1576 }
1577 }
1578 },
1579 "unevaluatedProperties": false
1580 },
1581 "tests": [
1582 {
1583 "description": "valid in case if is evaluated",
1584 "data": {
1585 "foo": "a"
1586 },
1587 "valid": true
1588 },
1589 {
1590 "description": "invalid in case if is evaluated",
1591 "data": {
1592 "bar": "a"
1593 },
1594 "valid": false
1595 }
1596 ]
1597 },
1598 {
1599 "description": "dependentSchemas with unevaluatedProperties",
1600 "schema": {
1601 "$schema": "https://json-schema.org/draft/2019-09/schema",
1602 "properties": {"foo2": {}},
1603 "dependentSchemas": {
1604 "foo" : {},
1605 "foo2": {
1606 "properties": {
1607 "bar":{}
1608 }
1609 }
1610 },
1611 "unevaluatedProperties": false
1612 },
1613 "tests": [
1614 {
1615 "description": "unevaluatedProperties doesn't consider dependentSchemas",
1616 "data": {"foo": ""},
1617 "valid": false
1618 },
1619 {
1620 "description": "unevaluatedProperties doesn't see bar when foo2 is absent",
1621 "data": {"bar": ""},
1622 "valid": false
1623 },
1624 {
1625 "description": "unevaluatedProperties sees bar when foo2 is present",
1626 "data": { "foo2": "", "bar": ""},
1627 "valid": true
1628 }
1629 ]
1630 },
1631 {
1632 "description": "Evaluated properties collection needs to consider instance location",
1633 "schema": {
1634 "$schema": "https://json-schema.org/draft/2019-09/schema",
1635 "properties": {
1636 "foo": {
1637 "properties": {
1638 "bar": { "type": "string" }
1639 }
1640 }
1641 },
1642 "unevaluatedProperties": false
1643 },
1644 "tests": [
1645 {
1646 "description": "with an unevaluated property that exists at another location",
1647 "data": {
1648 "foo": { "bar": "foo" },
1649 "bar": "bar"
1650 },
1651 "valid": false
1652 }
1653 ]
1654 },
1655 {
1656 "description": "Evaluated properties collection needs to consider instance location with patternProperties",
1657 "schema": {
1658 "$schema": "https://json-schema.org/draft/2019-09/schema",
1659 "properties": {
1660 "foo": {
1661 "patternProperties": {
1662 "^bar$": { "type": "string" }
1663 }
1664 }
1665 },
1666 "unevaluatedProperties": false
1667 },
1668 "tests": [
1669 {
1670 "description": "with only the nested evaluated property",
1671 "data": {
1672 "foo": { "bar": "foo" }
1673 },
1674 "valid": true
1675 },
1676 {
1677 "description": "with an unevaluated property that exists at another location",
1678 "data": {
1679 "foo": { "bar": "foo" },
1680 "bar": "bar"
1681 },
1682 "valid": false
1683 }
1684 ]
1685 },
1686 {
1687 "description": "Evaluated properties collection needs to consider instance location with additionalProperties",
1688 "schema": {
1689 "$schema": "https://json-schema.org/draft/2019-09/schema",
1690 "properties": {
1691 "foo": {
1692 "additionalProperties": { "type": "string" }
1693 }
1694 },
1695 "unevaluatedProperties": false
1696 },
1697 "tests": [
1698 {
1699 "description": "with only the nested evaluated property",
1700 "data": {
1701 "foo": { "bar": "foo" }
1702 },
1703 "valid": true
1704 },
1705 {
1706 "description": "with an unevaluated property that exists at another location",
1707 "data": {
1708 "foo": { "bar": "foo" },
1709 "bar": "bar"
1710 },
1711 "valid": false
1712 }
1713 ]
1714 }
1715 ]