Debian Codegraph @

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

raw ◀ ▶
1 Debian patch touch this file
•1 [
2 {
3 "description": "a schema given for prefixItems",
4 "schema": {
5 "prefixItems": [
6 {"type": "integer"},
7 {"type": "string"}
8 ]
9 },
10 "tests": [
11 {
12 "description": "correct types",
13 "data": [ 1, "foo" ],
14 "valid": true
15 },
16 {
17 "description": "wrong types",
18 "data": [ "foo", 1 ],
19 "valid": false
20 },
21 {
22 "description": "incomplete array of items",
23 "data": [ 1 ],
24 "valid": true
25 },
26 {
27 "description": "array with additional items",
28 "data": [ 1, "foo", true ],
29 "valid": true
30 },
31 {
32 "description": "empty array",
33 "data": [ ],
34 "valid": true
35 },
36 {
37 "description": "JavaScript pseudo-array is valid",
38 "data": {
39 "0": "invalid",
40 "1": "valid",
41 "length": 2
42 },
43 "valid": true
44 }
45 ]
46 },
47 {
48 "description": "prefixItems with boolean schemas",
49 "schema": {
50 "prefixItems": [true, false]
51 },
52 "tests": [
53 {
54 "description": "array with one item is valid",
55 "data": [ 1 ],
56 "valid": true
57 },
58 {
59 "description": "array with two items is invalid",
60 "data": [ 1, "foo" ],
61 "valid": false
62 },
63 {
64 "description": "empty array is valid",
65 "data": [],
66 "valid": true
67 }
68 ]
69 },
70 {
71 "description": "additional items are allowed by default",
72 "schema": {"prefixItems": [{"type": "integer"}]},
73 "tests": [
74 {
75 "description": "only the first item is validated",
76 "data": [1, "foo", false],
77 "valid": true
78 }
79 ]
80 }
81 ]