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