xref: /aosp_15_r20/external/json-schema-validator/src/test/resources/data/issue428.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2  {
3    "description": "Nuallable oneOf validation",
4    "schema": {
5      "properties": {
6        "values": {
7          "description": "desc",
8          "nullable": true,
9          "oneOf": [
10            {
11              "type": "array",
12              "items": {
13                "type": "string"
14              }
15            },
16            {
17              "type": "string"
18            }
19          ]
20        }
21      }
22    },
23    "tests": [
24      {
25        "description": "oneOf with valid array",
26        "data": {
27          "values": ["test1","test2"]
28        },
29        "valid": true
30      },
31      {
32        "description": "oneOf with invalid type of array",
33        "data": {
34          "values": [1,2]
35        },
36        "valid": true
37      },
38      {
39        "description": "nullable oneOf with null",
40        "data": {
41          "values": null
42        },
43        "valid": true
44      },
45      {
46        "description": "oneOf with single string",
47        "data": {
48          "values": "test"
49        },
50        "valid": true
51      },
52      {
53        "description": "oneOf with invalid type",
54        "data": {
55          "values": 3
56        },
57        "valid": true
58      },
59      {
60        "description": "oneOf with single string array",
61        "data": {
62          "values": [ "test1"]
63        },
64        "valid": true
65      }
66    ]
67  },
68  {
69    "description": "oneOf with child node nullable validation",
70    "schema": {
71      "properties": {
72        "values": {
73          "description": "desc",
74          "oneOf": [
75            {
76              "type": "array",
77              "nullable": true,
78              "items": {
79                "type": "string"
80              }
81            },
82            {
83              "type": "string",
84              "nullable": true
85            }
86          ]
87        }
88      }
89    },
90    "tests": [
91      {
92        "description": "nullable oneOf with null value",
93        "data": {
94          "values": null
95        },
96        "valid": true
97      },
98      {
99        "description": "oneOf with single string",
100        "data": {
101          "values": "test"
102        },
103        "valid": true
104      },
105      {
106        "description": "oneOf with invalid type",
107        "data": {
108          "values": 3
109        },
110        "valid": true
111      },
112      {
113        "description": "oneOf with single string array",
114        "data": {
115          "values": [ "test1"]
116        },
117        "valid": true
118      },
119      {
120        "description": "oneOf with invalid type of array",
121        "data": {
122          "values": [1,2]
123        },
124        "valid": true
125      }
126    ]
127  },
128  {
129    "description": "oneOf with single child node nullable validation",
130    "schema": {
131      "properties": {
132        "values": {
133          "description": "desc",
134          "oneOf": [
135            {
136              "type": "array",
137              "nullable": true,
138              "items": {
139                "type": "string"
140              }
141            },
142            {
143              "type": "string"
144            }
145          ]
146        }
147      }
148    },
149    "tests": [
150      {
151        "description": "nullable oneOf with null value",
152        "data": {
153          "values": null
154        },
155        "valid": true
156      },
157      {
158        "description": "oneOf with single string",
159        "data": {
160          "values": "test"
161        },
162        "valid": true
163      },
164      {
165        "description": "oneOf with invalid type",
166        "data": {
167          "values": 3
168        },
169        "valid": true
170      },
171      {
172        "description": "oneOf with single string array",
173        "data": {
174          "values": [ "test1"]
175        },
176        "valid": true
177      },
178      {
179        "description": "oneOf with invalid type of array",
180        "data": {
181          "values": [1,2]
182        },
183        "valid": true
184      }
185    ]
186  },
187  {
188    "description": "Nuallable oneOf with child node nullable validation",
189    "schema": {
190      "properties": {
191        "values": {
192          "description": "desc",
193          "nullable": true,
194          "oneOf": [
195            {
196              "type": "array",
197              "nullable": true,
198              "items": {
199                "type": "string"
200              }
201            },
202            {
203              "type": "string",
204              "nullable": true
205            }
206          ]
207        }
208      }
209    },
210    "tests": [
211      {
212        "description": "nullable oneOf",
213        "data": {
214          "values": null
215        },
216        "valid": true
217      },
218      {
219        "description": "oneOf with single string",
220        "data": {
221          "values": "test"
222        },
223        "valid": true
224      },
225      {
226        "description": "oneOf with invalid type",
227        "data": {
228          "values": 3
229        },
230        "valid": true
231      },
232      {
233        "description": "oneOf with single string array",
234        "data": {
235          "values": [ "test1"]
236        },
237        "valid": true
238      },
239      {
240        "description": "oneOf with invalid type of array",
241        "data": {
242          "values": [1,2]
243        },
244        "valid": true
245      }
246    ]
247  }
248]
249