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