Debian Codegraph @

spec/JSON-Schema-Test-Suite/tests/draft2020-12/dependentSchemas.json

raw ◀ ▶
1 Debian patch touch this file
•1 [
2 {
3 "description": "single dependency",
4 "schema": {
5 "dependentSchemas": {
6 "bar": {
7 "properties": {
8 "foo": {"type": "integer"},
9 "bar": {"type": "integer"}
10 }
11 }
12 }
13 },
14 "tests": [
15 {
16 "description": "valid",
17 "data": {"foo": 1, "bar": 2},
18 "valid": true
19 },
20 {
21 "description": "no dependency",
22 "data": {"foo": "quux"},
23 "valid": true
24 },
25 {
26 "description": "wrong type",
27 "data": {"foo": "quux", "bar": 2},
28 "valid": false
29 },
30 {
31 "description": "wrong type other",
32 "data": {"foo": 2, "bar": "quux"},
33 "valid": false
34 },
35 {
36 "description": "wrong type both",
37 "data": {"foo": "quux", "bar": "quux"},
38 "valid": false
39 },
40 {
41 "description": "ignores arrays",
42 "data": ["bar"],
43 "valid": true
44 },
45 {
46 "description": "ignores strings",
47 "data": "foobar",
48 "valid": true
49 },
50 {
51 "description": "ignores other non-objects",
52 "data": 12,
53 "valid": true
54 }
55 ]
56 },
57 {
58 "description": "boolean subschemas",
59 "schema": {
60 "dependentSchemas": {
61 "foo": true,
62 "bar": false
63 }
64 },
65 "tests": [
66 {
67 "description": "object with property having schema true is valid",
68 "data": {"foo": 1},
69 "valid": true
70 },
71 {
72 "description": "object with property having schema false is invalid",
73 "data": {"bar": 2},
74 "valid": false
75 },
76 {
77 "description": "object with both properties is invalid",
78 "data": {"foo": 1, "bar": 2},
79 "valid": false
80 },
81 {
82 "description": "empty object is valid",
83 "data": {},
84 "valid": true
85 }
86 ]
87 },
88 {
89 "description": "dependencies with escaped characters",
90 "schema": {
91 "dependentSchemas": {
92 "foo\tbar": {"minProperties": 4},
93 "foo'bar": {"required": ["foo\"bar"]}
94 }
95 },
96 "tests": [
97 {
98 "description": "quoted tab",
99 "data": {
100 "foo\tbar": 1,
101 "a": 2,
102 "b": 3,
103 "c": 4
104 },
105 "valid": true
106 },
107 {
108 "description": "quoted quote",
109 "data": {
110 "foo'bar": {"foo\"bar": 1}
111 },
112 "valid": false
113 },
114 {
115 "description": "quoted tab invalid under dependent schema",
116 "data": {
117 "foo\tbar": 1,
118 "a": 2
119 },
120 "valid": false
121 },
122 {
123 "description": "quoted quote invalid under dependent schema",
124 "data": {"foo'bar": 1},
125 "valid": false
126 }
127 ]
128 }
129 ]