summaryrefslogtreecommitdiff
path: root/json/tests/draft7/optional/content.json
blob: 3f5a7430b27d2391f47f580861bd90993b8c4412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
[
    {
        "description": "validation of string-encoded content based on media type",
        "schema": {
            "contentMediaType": "application/json"
        },
        "tests": [
            {
                "description": "a valid JSON document",
                "data": "{\"foo\": \"bar\"}",
                "valid": true
            },
            {
                "description": "an invalid JSON document",
                "data": "{:}",
                "valid": false
            },
            {
                "description": "ignores non-strings",
                "data": 100,
                "valid": true
            }
        ]
    },
    {
        "description": "validation of binary string-encoding",
        "schema": {
            "contentEncoding": "base64"
        },
        "tests": [
            {
                "description": "a valid base64 string",
                "data": "eyJmb28iOiAiYmFyIn0K",
                "valid": true
            },
            {
                "description": "an invalid base64 string (% is not a valid character)",
                "data": "eyJmb28iOi%iYmFyIn0K",
                "valid": false
            },
            {
                "description": "ignores non-strings",
                "data": 100,
                "valid": true
            }
        ]
    },
    {
        "description": "validation of binary-encoded media type documents",
        "schema": {
            "contentMediaType": "application/json",
            "contentEncoding": "base64"
        },
        "tests": [
            {
                "description": "a valid base64-encoded JSON document",
                "data": "eyJmb28iOiAiYmFyIn0K",
                "valid": true
            },
            {
                "description": "a validly-encoded invalid JSON document",
                "data": "ezp9Cg==",
                "valid": false
            },
            {
                "description": "an invalid base64 string that is valid JSON",
                "data": "{}",
                "valid": false
            },
            {
                "description": "ignores non-strings",
                "data": 100,
                "valid": true
            }
        ]
    }
]