Debian Codegraph @

share/tests/v1/not.json

raw
1 [
2 {
3 "description": "not",
4 "schema": {
5 "$schema": "https://json-schema.org/v1",
6 "not": {"type": "integer"}
7 },
8 "tests": [
9 {
10 "description": "allowed",
11 "data": "foo",
12 "valid": true
13 },
14 {
15 "description": "disallowed",
16 "data": 1,
17 "valid": false
18 }
19 ]
20 },
21 {
22 "description": "not multiple types",
23 "schema": {
24 "$schema": "https://json-schema.org/v1",
25 "not": {"type": ["integer", "boolean"]}
26 },
27 "tests": [
28 {
29 "description": "valid",
30 "data": "foo",
31 "valid": true
32 },
33 {
34 "description": "mismatch",
35 "data": 1,
36 "valid": false
37 },
38 {
39 "description": "other mismatch",
40 "data": true,
41 "valid": false
42 }
43 ]
44 },
45 {
46 "description": "not more complex schema",
47 "schema": {
48 "$schema": "https://json-schema.org/v1",
49 "not": {
50 "type": "object",
51 "properties": {
52 "foo": {
53 "type": "string"
54 }
55 }
56 }
57 },
58 "tests": [
59 {
60 "description": "match",
61 "data": 1,
62 "valid": true
63 },
64 {
65 "description": "other match",
66 "data": {"foo": 1},
67 "valid": true
68 },
69 {
70 "description": "mismatch",
71 "data": {"foo": "bar"},
72 "valid": false
73 }
74 ]
75 },
76 {
77 "description": "forbidden property",
78 "schema": {
79 "$schema": "https://json-schema.org/v1",
80 "properties": {
81 "foo": {
82 "not": {}
83 }
84 }
85 },
86 "tests": [
87 {
88 "description": "property present",
89 "data": {"foo": 1, "bar": 2},
90 "valid": false
91 },
92 {
93 "description": "property absent",
94 "data": {"bar": 1, "baz": 2},
95 "valid": true
96 }
97 ]
98 },
99 {
100 "description": "forbid everything with empty schema",
101 "schema": {
102 "$schema": "https://json-schema.org/v1",
103 "not": {}
104 },
105 "tests": [
106 {
107 "description": "number is invalid",
108 "data": 1,
109 "valid": false
110 },
111 {
112 "description": "string is invalid",
113 "data": "foo",
114 "valid": false
115 },
116 {
117 "description": "boolean true is invalid",
118 "data": true,
119 "valid": false
120 },
121 {
122 "description": "boolean false is invalid",
123 "data": false,
124 "valid": false
125 },
126 {
127 "description": "null is invalid",
128 "data": null,
129 "valid": false
130 },
131 {
132 "description": "object is invalid",
133 "data": {"foo": "bar"},
134 "valid": false
135 },
136 {
137 "description": "empty object is invalid",
138 "data": {},
139 "valid": false
140 },
141 {
142 "description": "array is invalid",
143 "data": ["foo"],
144 "valid": false
145 },
146 {
147 "description": "empty array is invalid",
148 "data": [],
149 "valid": false
150 }
151 ]
152 },
153 {
154 "description": "forbid everything with boolean schema true",
155 "schema": {
156 "$schema": "https://json-schema.org/v1",
157 "not": true
158 },
159 "tests": [
160 {
161 "description": "number is invalid",
162 "data": 1,
163 "valid": false
164 },
165 {
166 "description": "string is invalid",
167 "data": "foo",
168 "valid": false
169 },
170 {
171 "description": "boolean true is invalid",
172 "data": true,
173 "valid": false
174 },
175 {
176 "description": "boolean false is invalid",
177 "data": false,
178 "valid": false
179 },
180 {
181 "description": "null is invalid",
182 "data": null,
183 "valid": false
184 },
185 {
186 "description": "object is invalid",
187 "data": {"foo": "bar"},
188 "valid": false
189 },
190 {
191 "description": "empty object is invalid",
192 "data": {},
193 "valid": false
194 },
195 {
196 "description": "array is invalid",
197 "data": ["foo"],
198 "valid": false
199 },
200 {
201 "description": "empty array is invalid",
202 "data": [],
203 "valid": false
204 }
205 ]
206 },
207 {
208 "description": "allow everything with boolean schema false",
209 "schema": {
210 "$schema": "https://json-schema.org/v1",
211 "not": false
212 },
213 "tests": [
214 {
215 "description": "number is valid",
216 "data": 1,
217 "valid": true
218 },
219 {
220 "description": "string is valid",
221 "data": "foo",
222 "valid": true
223 },
224 {
225 "description": "boolean true is valid",
226 "data": true,
227 "valid": true
228 },
229 {
230 "description": "boolean false is valid",
231 "data": false,
232 "valid": true
233 },
234 {
235 "description": "null is valid",
236 "data": null,
237 "valid": true
238 },
239 {
240 "description": "object is valid",
241 "data": {"foo": "bar"},
242 "valid": true
243 },
244 {
245 "description": "empty object is valid",
246 "data": {},
247 "valid": true
248 },
249 {
250 "description": "array is valid",
251 "data": ["foo"],
252 "valid": true
253 },
254 {
255 "description": "empty array is valid",
256 "data": [],
257 "valid": true
258 }
259 ]
260 },
261 {
262 "description": "double negation",
263 "schema": {
264 "$schema": "https://json-schema.org/v1",
265 "not": { "not": {} }
266 },
267 "tests": [
268 {
269 "description": "any value is valid",
270 "data": "foo",
271 "valid": true
272 }
273 ]
274 },
275 {
276 "description": "collect annotations inside a 'not', even if collection is disabled",
277 "schema": {
278 "$schema": "https://json-schema.org/v1",
279 "not": {
280 "$comment": "this subschema must still produce annotations internally, even though the 'not' will ultimately discard them",
281 "anyOf": [
282 true,
283 { "properties": { "foo": true } }
284 ],
285 "unevaluatedProperties": false
286 }
287 },
288 "tests": [
289 {
290 "description": "unevaluated property",
291 "data": { "bar": 1 },
292 "valid": true
293 },
294 {
295 "description": "annotations are still collected inside a 'not'",
296 "data": { "foo": 1 },
297 "valid": false
298 }
299 ]
300 }
301 ]