xref: /freebsd/contrib/libucl/tests/schema/items.json (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
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