1[
2 {
3 "description": "dependencies",
4 "schema": {
5 "dependencies": {"bar": ["foo"]}
6 },
7 "tests": [
8 {
9 "description": "neither",
10 "data": {},
11 "valid": true
12 },
13 {
14 "description": "nondependant",
15 "data": {"foo": 1},
16 "valid": true
17 },
18 {
19 "description": "with dependency",
20 "data": {"foo": 1, "bar": 2},
21 "valid": true
22 },
23 {
24 "description": "missing dependency",
25 "data": {"bar": 2},
26 "valid": false
27 },
28 {
29 "description": "ignores arrays",
30 "data": ["bar"],
31 "valid": true
32 },
33 {
34 "description": "ignores strings",
35 "data": "foobar",
36 "valid": true
37 },
38 {
39 "description": "ignores other non-objects",
40 "data": 12,
41 "valid": true
42 }
43 ]
44 },
45 {
46 "description": "multiple dependencies",
47 "schema": {
48 "dependencies": {"quux": ["foo", "bar"]}
49 },
50 "tests": [
51 {
52 "description": "neither",
53 "data": {},
54 "valid": true
55 },
56 {
57 "description": "nondependants",
58 "data": {"foo": 1, "bar": 2},
59 "valid": true
60 },
61 {
62 "description": "with dependencies",
63 "data": {"foo": 1, "bar": 2, "quux": 3},
64 "valid": true
65 },
66 {
67 "description": "missing dependency",
68 "data": {"foo": 1, "quux": 2},
69 "valid": false
70 },
71 {
72 "description": "missing other dependency",
73 "data": {"bar": 1, "quux": 2},
74 "valid": false
75 },
76 {
77 "description": "missing both dependencies",
78 "data": {"quux": 1},
79 "valid": false
80 }
81 ]
82 },
83 {
84 "description": "multiple dependencies subschema",
85 "schema": {
86 "dependencies": {
87 "bar": {
88 "properties": {
89 "foo": {"type": "integer"},
90 "bar": {"type": "integer"}
91 }
92 }
93 }
94 },
95 "tests": [
96 {
97 "description": "valid",
98 "data": {"foo": 1, "bar": 2},
99 "valid": true
100 },
101 {
102 "description": "no dependency",
103 "data": {"foo": "quux"},
104 "valid": true
105 },
106 {
107 "description": "wrong type",
108 "data": {"foo": "quux", "bar": 2},
109 "valid": false
110 },
111 {
112 "description": "wrong type other",
113 "data": {"foo": 2, "bar": "quux"},
114 "valid": false
115 },
116 {
117 "description": "wrong type both",
118 "data": {"foo": "quux", "bar": "quux"},
119 "valid": false
120 }
121 ]
122 },
123 {
124 "description": "dependencies with escaped characters",
125 "schema": {
126 "dependencies": {
127 "foo\nbar": ["foo\rbar"],
128 "foo\tbar": {
129 "minProperties": 4
130 },
131 "foo'bar": {"required": ["foo\"bar"]},
132 "foo\"bar": ["foo'bar"]
133 }
134 },
135 "tests": [
136 {
137 "description": "valid object 1",
138 "data": {
139 "foo\nbar": 1,
140 "foo\rbar": 2
141 },
142 "valid": true
143 },
144 {
145 "description": "valid object 2",
146 "data": {
147 "foo\tbar": 1,
148 "a": 2,
149 "b": 3,
150 "c": 4
151 },
152 "valid": true
153 },
154 {
155 "description": "valid object 3",
156 "data": {
157 "foo'bar": 1,
158 "foo\"bar": 2
159 },
160 "valid": true
161 },
162 {
163 "description": "invalid object 1",
164 "data": {
165 "foo\nbar": 1,
166 "foo": 2
167 },
168 "valid": false
169 },
170 {
171 "description": "invalid object 2",
172 "data": {
173 "foo\tbar": 1,
174 "a": 2
175 },
176 "valid": false
177 },
178 {
179 "description": "invalid object 3",
180 "data": {
181 "foo'bar": 1
182 },
183 "valid": false
184 },
185 {
186 "description": "invalid object 4",
187 "data": {
188 "foo\"bar": 2
189 },
190 "valid": false
191 }
192 ]
193 }
194]
View as plain text