xref: /aosp_15_r20/external/json-schema-validator/src/test/suite/tests/draft2020-12/content.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2    {
3        "description": "validation of string-encoded content based on media type",
4        "schema": {
5            "$schema": "https://json-schema.org/draft/2020-12/schema",
6            "contentMediaType": "application/json"
7        },
8        "tests": [
9            {
10                "description": "a valid JSON document",
11                "data": "{\"foo\": \"bar\"}",
12                "valid": true
13            },
14            {
15                "description": "an invalid JSON document; validates true",
16                "data": "{:}",
17                "valid": true
18            },
19            {
20                "description": "ignores non-strings",
21                "data": 100,
22                "valid": true
23            }
24        ]
25    },
26    {
27        "description": "validation of binary string-encoding",
28        "schema": {
29            "$schema": "https://json-schema.org/draft/2020-12/schema",
30            "contentEncoding": "base64"
31        },
32        "tests": [
33            {
34                "description": "a valid base64 string",
35                "data": "eyJmb28iOiAiYmFyIn0K",
36                "valid": true
37            },
38            {
39                "description": "an invalid base64 string (% is not a valid character); validates true",
40                "data": "eyJmb28iOi%iYmFyIn0K",
41                "valid": true
42            },
43            {
44                "description": "ignores non-strings",
45                "data": 100,
46                "valid": true
47            }
48        ]
49    },
50    {
51        "description": "validation of binary-encoded media type documents",
52        "schema": {
53            "$schema": "https://json-schema.org/draft/2020-12/schema",
54            "contentMediaType": "application/json",
55            "contentEncoding": "base64"
56        },
57        "tests": [
58            {
59                "description": "a valid base64-encoded JSON document",
60                "data": "eyJmb28iOiAiYmFyIn0K",
61                "valid": true
62            },
63            {
64                "description": "a validly-encoded invalid JSON document; validates true",
65                "data": "ezp9Cg==",
66                "valid": true
67            },
68            {
69                "description": "an invalid base64 string that is valid JSON; validates true",
70                "data": "{}",
71                "valid": true
72            },
73            {
74                "description": "ignores non-strings",
75                "data": 100,
76                "valid": true
77            }
78        ]
79    },
80    {
81        "description": "validation of binary-encoded media type documents with schema",
82        "schema": {
83            "$schema": "https://json-schema.org/draft/2020-12/schema",
84            "contentMediaType": "application/json",
85            "contentEncoding": "base64",
86            "contentSchema": { "type": "object", "required": ["foo"], "properties": { "foo": { "type": "string" } } }
87        },
88        "tests": [
89            {
90                "description": "a valid base64-encoded JSON document",
91                "data": "eyJmb28iOiAiYmFyIn0K",
92                "valid": true
93            },
94            {
95                "description": "another valid base64-encoded JSON document",
96                "data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
97                "valid": true
98            },
99            {
100                "description": "an invalid base64-encoded JSON document; validates true",
101                "data": "eyJib28iOiAyMH0=",
102                "valid": true
103            },
104            {
105                "description": "an empty object as a base64-encoded JSON document; validates true",
106                "data": "e30=",
107                "valid": true
108            },
109            {
110                "description": "an empty array as a base64-encoded JSON document",
111                "data": "W10=",
112                "valid": true
113            },
114            {
115                "description": "a validly-encoded invalid JSON document; validates true",
116                "data": "ezp9Cg==",
117                "valid": true
118            },
119            {
120                "description": "an invalid base64 string that is valid JSON; validates true",
121                "data": "{}",
122                "valid": true
123            },
124            {
125                "description": "ignores non-strings",
126                "data": 100,
127                "valid": true
128            }
129        ]
130    }
131]
132