Debian Codegraph @

t/additional-tests-draft2019-09/short-circuit.json

raw
1 [
2 {
3 "description": "short-circuit with items (schema form)",
4 "schema": {
5 "items": { "multipleOf": 2 }
6 },
7 "tests": [
8 {
9 "description": "single item is valid",
10 "data": [ 2 ],
11 "valid": true
12 },
13 {
14 "description": "second item is invalid",
15 "data": [ 2, 1 ],
16 "valid": false
17 }
18 ]
19 },
20 {
21 "description": "short-circuit with items (array form)",
22 "schema": {
23 "items": [
24 { "multipleOf": 2 },
25 { "multipleOf": 2 }
26 ]
27 },
28 "tests": [
29 {
30 "description": "single item is valid",
31 "data": [ 2 ],
32 "valid": true
33 },
34 {
35 "description": "second item is invalid",
36 "data": [ 2, 1 ],
37 "valid": false
38 }
39 ]
40 },
41 {
42 "description": "short-circuit with additionalItems",
43 "schema": {
44 "items": [ true ],
45 "additionalItems": { "multipleOf": 2 }
46 },
47 "tests": [
48 {
49 "description": "single additional item is valid",
50 "data": [ 1, 2 ],
51 "valid": true
52 },
53 {
54 "description": "second additional item is invalid",
55 "data": [ 1, 2, 1 ],
56 "valid": false
57 }
58 ]
59 },
60 {
61 "description": "short-circuit with unevaluatedItems",
62 "schema": {
63 "unevaluatedItems": { "multipleOf": 2 }
64 },
65 "tests": [
66 {
67 "description": "single item is valid",
68 "data": [ 2 ],
69 "valid": true
70 },
71 {
72 "description": "second item is invalid",
73 "data": [ 2, 1 ],
74 "valid": false
75 }
76 ]
77 },
78 {
79 "description": "short-circuit with properties",
80 "schema": {
81 "properties": {
82 "alpha": { "multipleOf": 2 },
83 "beta": { "multipleOf": 2 }
84 }
85 },
86 "tests": [
87 {
88 "description": "single property is valid",
89 "data": { "alpha": 2 },
90 "valid": true
91 },
92 {
93 "description": "second property is invalid",
94 "data": { "alpha": 2, "beta": 1 },
95 "valid": false
96 }
97 ]
98 },
99 {
100 "description": "short-circuit with properties and unevaluatedProperties",
101 "schema": {
102 "properties": {
103 "alpha": true,
104 "beta": false,
105 "gamma": true
106 },
107 "unevaluatedProperties": false
108 },
109 "tests": [
110 {
111 "description": "single property is valid",
112 "data": { "alpha": 1 },
113 "valid": true
114 },
115 {
116 "description": "second property is invalid",
117 "data": { "alpha": 1, "beta": 2 },
118 "valid": false
119 }
120 ]
121 },
122 {
123 "description": "short-circuit with patternProperties",
124 "schema": {
125 "patternProperties": {
126 "^a": { "multipleOf": 2 },
127 "^b": { "multipleOf": 2 }
128 }
129 },
130 "tests": [
131 {
132 "description": "single property is valid",
133 "data": { "alpha": 2 },
134 "valid": true
135 },
136 {
137 "description": "second property is invalid",
138 "data": { "alpha": 2, "beta": 1 },
139 "valid": false
140 }
141 ]
142 },
143 {
144 "description": "short-circuit with patternProperties and boolean schemas",
145 "schema": {
146 "patternProperties": {
147 "^a": true,
148 "^b": false
149 }
150 },
151 "tests": [
152 {
153 "description": "single property is valid",
154 "data": { "alpha": 2 },
155 "valid": true
156 },
157 {
158 "description": "second property is invalid",
159 "data": { "alpha": 2, "beta": 1 },
160 "valid": false
161 }
162 ]
163 },
164 {
165 "description": "short-circuit with additionalProperties",
166 "schema": {
167 "additionalProperties": { "multipleOf": 2 }
168 },
169 "tests": [
170 {
171 "description": "single property is valid",
172 "data": { "alpha": 2 },
173 "valid": true
174 },
175 {
176 "description": "second property is invalid",
177 "data": { "alpha": 2, "beta": 1 },
178 "valid": false
179 }
180 ]
181 },
182 {
183 "description": "short-circuit with unevaluatedProperties",
184 "schema": {
185 "unevaluatedProperties": { "multipleOf": 2 }
186 },
187 "tests": [
188 {
189 "description": "single property is valid",
190 "data": { "alpha": 2 },
191 "valid": true
192 },
193 {
194 "description": "second property is invalid",
195 "data": { "alpha": 2, "beta": 1 },
196 "valid": false
197 }
198 ]
199 },
200 {
201 "description": "short-circuit with allOf",
202 "schema": {
203 "allOf": [
204 false,
205 {
206 "properties": {
207 "alpha": {},
208 "beta": {}
209 }
210 }
211 ],
212 "unevaluatedProperties": false
213 },
214 "tests": [
215 {
216 "description": "'unevaluated' errors are produced iff short_circuit is false",
217 "data": { "alpha": 1, "gamma": 3 },
218 "valid": false
219 },
220 {
221 "description": "/allOf/0 guarantees a false result even when all branches are evaluated",
222 "data": { "alpha": 1, "beta": 2 },
223 "valid": false
224 }
225 ]
226 },
227 {
228 "description": "short-circuit with anyOf",
229 "schema": {
230 "anyOf": [
231 true,
232 {
233 "properties": {
234 "alpha": {},
235 "beta": {}
236 }
237 }
238 ],
239 "unevaluatedProperties": false
240 },
241 "tests": [
242 {
243 "description": "some properties are unevaluated",
244 "data": { "alpha": 1, "gamma": 1 },
245 "valid": false
246 },
247 {
248 "description": "all branches are still evaluated, even though we would have wanted to abort earlier",
249 "data": { "alpha": 1, "beta": 2 },
250 "valid": true
251 }
252 ]
253 },
254 {
255 "description": "short-circuit with oneOf",
256 "schema": {
257 "oneOf": [
258 {
259 "required": ["alpha"],
260 "properties": {
261 "alpha": { "const": 1 }
262 }
263 },
264 {
265 "required": ["beta"],
266 "properties": {
267 "beta": { "const": 2 }
268 }
269 },
270 {
271 "required": ["gamma"],
272 "properties": {
273 "gamma": { "const": 3 }
274 }
275 }
276 ],
277 "unevaluatedProperties": false
278 },
279 "tests": [
280 {
281 "description": "we can safely short-circuit after two valid oneOfs; gamma never gets evaluated; incorrect unevaluated error is not produced",
282 "data": { "alpha": 1, "beta": 2, "gamma": 3 },
283 "valid": false
284 },
285 {
286 "description": "all branches are still evaluated, even though we would have wanted to abort earlier",
287 "data": { "alpha": 1, "delta": 4 },
288 "valid": false
289 }
290 ]
291 }
292 ]