xref: /aosp_15_r20/external/json-schema-validator/src/test/suite/tests/draft2020-12/maxItems.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2    {
3        "description": "maxItems validation",
4        "schema": {
5            "$schema": "https://json-schema.org/draft/2020-12/schema",
6            "maxItems": 2
7        },
8        "tests": [
9            {
10                "description": "shorter is valid",
11                "data": [1],
12                "valid": true
13            },
14            {
15                "description": "exact length is valid",
16                "data": [1, 2],
17                "valid": true
18            },
19            {
20                "description": "too long is invalid",
21                "data": [1, 2, 3],
22                "valid": false
23            },
24            {
25                "description": "ignores non-arrays",
26                "data": "foobar",
27                "valid": true
28            }
29        ]
30    },
31    {
32        "description": "maxItems validation with a decimal",
33        "schema": {
34            "$schema": "https://json-schema.org/draft/2020-12/schema",
35            "maxItems": 2.0
36        },
37        "tests": [
38            {
39                "description": "shorter is valid",
40                "data": [1],
41                "valid": true
42            },
43            {
44                "description": "too long is invalid",
45                "data": [1, 2, 3],
46                "valid": false
47            }
48        ]
49    }
50]
51