xref: /aosp_15_r20/external/json-schema-validator/src/test/suite/tests/draft3/items.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2    {
3        "description": "a schema given for items",
4        "schema": {
5            "items": {"type": "integer"}
6        },
7        "tests": [
8            {
9                "description": "valid items",
10                "data": [ 1, 2, 3 ],
11                "valid": true
12            },
13            {
14                "description": "wrong type of items",
15                "data": [1, "x"],
16                "valid": false
17            },
18            {
19                "description": "ignores non-arrays",
20                "data": {"foo" : "bar"},
21                "valid": true
22            }
23        ]
24    },
25    {
26        "description": "an array of schemas for items",
27        "schema": {
28            "items": [
29                {"type": "integer"},
30                {"type": "string"}
31            ]
32        },
33        "tests": [
34            {
35                "description": "correct types",
36                "data": [ 1, "foo" ],
37                "valid": true
38            },
39            {
40                "description": "wrong types",
41                "data": [ "foo", 1 ],
42                "valid": false
43            }
44        ]
45    },
46    {
47        "description": "items with null instance elements",
48        "schema": {
49            "items": {
50                "type": "null"
51            }
52        },
53        "tests": [
54            {
55                "description": "allows null elements",
56                "data": [ null ],
57                "valid": true
58            }
59        ]
60    },
61    {
62        "description": "array-form items with null instance elements",
63        "schema": {
64            "items": [
65                {
66                    "type": "null"
67                }
68            ]
69        },
70        "tests": [
71            {
72                "description": "allows null elements",
73                "data": [ null ],
74                "valid": true
75            }
76        ]
77    }
78]
79