summaryrefslogtreecommitdiff
path: root/json/tests/draft4/oneOf.json
blob: 1eaa4e47949dc312875bc492377d581a98201a2c (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
[
    {
        "description": "oneOf",
        "schema": {
            "oneOf": [
                {
                    "type": "integer"
                },
                {
                    "minimum": 2
                }
            ]
        },
        "tests": [
            {
                "description": "first oneOf valid",
                "data": 1,
                "valid": true
            },
            {
                "description": "second oneOf valid",
                "data": 2.5,
                "valid": true
            },
            {
                "description": "both oneOf valid",
                "data": 3,
                "valid": false
            },
            {
                "description": "neither oneOf valid",
                "data": 1.5,
                "valid": false
            }
        ]
    },
    {
        "description": "oneOf with base schema",
        "schema": {
            "type": "string",
            "oneOf" : [
                {
                    "minLength": 2
                },
                {
                    "maxLength": 4
                }
            ]
        },
        "tests": [
            {
                "description": "mismatch base schema",
                "data": 3,
                "valid": false
            },
            {
                "description": "one oneOf valid",
                "data": "foobar",
                "valid": true
            },
            {
                "description": "both oneOf valid",
                "data": "foo",
                "valid": false
            }
        ]
    }
]