xref: /aosp_15_r20/external/json-schema-validator/src/test/resources/draft4/issue425.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 single string",
26        "data": {
27          "values": "test"
28        },
29        "valid": true
30      },
31      {
32        "description": "oneOf with invalid type",
33        "data": {
34          "values": 3
35        },
36        "valid": false,
37        "validationMessages": [
38          "$.values: must be valid to one and only one schema, but 0 are valid",
39          "$.values: integer found, array expected",
40          "$.values: integer found, string expected"
41        ]
42      },
43      {
44        "description": "oneOf with single string array",
45        "data": {
46          "values": [ "test1"]
47        },
48        "valid": true
49      }
50    ]
51  }
52]
53