summaryrefslogtreecommitdiff
path: root/json/tests/draft2020-12/not.json
blob: 98de0eda8dd0f25b914c0594b87b79ba5ee8516c (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
[
    {
        "description": "not",
        "schema": {
            "not": {"type": "integer"}
        },
        "tests": [
            {
                "description": "allowed",
                "data": "foo",
                "valid": true
            },
            {
                "description": "disallowed",
                "data": 1,
                "valid": false
            }
        ]
    },
    {
        "description": "not multiple types",
        "schema": {
            "not": {"type": ["integer", "boolean"]}
        },
        "tests": [
            {
                "description": "valid",
                "data": "foo",
                "valid": true
            },
            {
                "description": "mismatch",
                "data": 1,
                "valid": false
            },
            {
                "description": "other mismatch",
                "data": true,
                "valid": false
            }
        ]
    },
    {
        "description": "not more complex schema",
        "schema": {
            "not": {
                "type": "object",
                "properties": {
                    "foo": {
                        "type": "string"
                    }
                }
             }
        },
        "tests": [
            {
                "description": "match",
                "data": 1,
                "valid": true
            },
            {
                "description": "other match",
                "data": {"foo": 1},
                "valid": true
            },
            {
                "description": "mismatch",
                "data": {"foo": "bar"},
                "valid": false
            }
        ]
    },
    {
        "description": "forbidden property",
        "schema": {
            "properties": {
                "foo": { 
                    "not": {}
                }
            }
        },
        "tests": [
            {
                "description": "property present",
                "data": {"foo": 1, "bar": 2},
                "valid": false
            },
            {
                "description": "property absent",
                "data": {"bar": 1, "baz": 2},
                "valid": true
            }
        ]
    },
    {
        "description": "not with boolean schema true",
        "schema": {"not": true},
        "tests": [
            {
                "description": "any value is invalid",
                "data": "foo",
                "valid": false
            }
        ]
    },
    {
        "description": "not with boolean schema false",
        "schema": {"not": false},
        "tests": [
            {
                "description": "any value is valid",
                "data": "foo",
                "valid": true
            }
        ]
    }
]