1[
2    {
3        "description": "oneOf",
4        "schema": {
5            "oneOf": [
6                {
7                    "type": "integer"
8                },
9                {
10                    "minimum": 2
11                }
12            ]
13        },
14        "tests": [
15            {
16                "description": "first oneOf valid",
17                "data": 1,
18                "valid": true
19            },
20            {
21                "description": "second oneOf valid",
22                "data": 2.5,
23                "valid": true
24            },
25            {
26                "description": "both oneOf valid",
27                "data": 3,
28                "valid": false
29            },
30            {
31                "description": "neither oneOf valid",
32                "data": 1.5,
33                "valid": false
34            }
35        ]
36    },
37    {
38        "description": "oneOf with base schema",
39        "schema": {
40            "type": "string",
41            "oneOf" : [
42                {
43                    "minLength": 2
44                },
45                {
46                    "maxLength": 4
47                }
48            ]
49        },
50        "tests": [
51            {
52                "description": "mismatch base schema",
53                "data": 3,
54                "valid": false
55            },
56            {
57                "description": "one oneOf valid",
58                "data": "foobar",
59                "valid": true
60            },
61            {
62                "description": "both oneOf valid",
63                "data": "foo",
64                "valid": false
65            }
66        ]
67    },
68    {
69        "description": "oneOf with boolean schemas, all true",
70        "schema": {"oneOf": [true, true, true]},
71        "tests": [
72            {
73                "description": "any value is invalid",
74                "data": "foo",
75                "valid": false
76            }
77        ]
78    },
79    {
80        "description": "oneOf with boolean schemas, one true",
81        "schema": {"oneOf": [true, false, false]},
82        "tests": [
83            {
84                "description": "any value is valid",
85                "data": "foo",
86                "valid": true
87            }
88        ]
89    },
90    {
91        "description": "oneOf with boolean schemas, more than one true",
92        "schema": {"oneOf": [true, true, false]},
93        "tests": [
94            {
95                "description": "any value is invalid",
96                "data": "foo",
97                "valid": false
98            }
99        ]
100    },
101    {
102        "description": "oneOf with boolean schemas, all false",
103        "schema": {"oneOf": [false, false, false]},
104        "tests": [
105            {
106                "description": "any value is invalid",
107                "data": "foo",
108                "valid": false
109            }
110        ]
111    },
112    {
113        "description": "oneOf complex types",
114        "schema": {
115            "oneOf": [
116                {
117                    "properties": {
118                        "bar": {"type": "integer"}
119                    },
120                    "required": ["bar"]
121                },
122                {
123                    "properties": {
124                        "foo": {"type": "string"}
125                    },
126                    "required": ["foo"]
127                }
128            ]
129        },
130        "tests": [
131            {
132                "description": "first oneOf valid (complex)",
133                "data": {"bar": 2},
134                "valid": true
135            },
136            {
137                "description": "second oneOf valid (complex)",
138                "data": {"foo": "baz"},
139                "valid": true
140            },
141            {
142                "description": "both oneOf valid (complex)",
143                "data": {"foo": "baz", "bar": 2},
144                "valid": false
145            },
146            {
147                "description": "neither oneOf valid (complex)",
148                "data": {"foo": 2, "bar": "quux"},
149                "valid": false
150            }
151        ]
152    }
153]
154