xref: /aosp_15_r20/external/json-schema-validator/src/test/resources/draft7/issue678.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2  {
3    "description": "issue678",
4    "schema": {
5      "$schema": "http://json-schema.org/draft-07/schema#",
6      "$id": "https://example.com/issue-470.json",
7      "title": "OneOf validation message",
8      "description": "Test description",
9      "type": "object",
10      "properties": {
11        "outerObject": {
12          "type": "object",
13          "properties": {
14            "innerObject": {
15              "oneOf": [
16                {
17                  "type": "string"
18                },
19                {
20                  "type": "object",
21                  "properties": {
22                    "value": {
23                      "type": "string"
24                    },
25                    "unit": {
26                      "type": "string"
27                    }
28                  },
29                  "additionalProperties": false,
30                  "required": [
31                    "value",
32                    "unit"
33                  ]
34                }
35              ]
36            }
37          }
38        }
39      },
40      "additionalProperties": false
41    },
42    "tests": [
43      {
44        "description": "OneOfValidator is filtering out the required errors if all the oneOf schemas are having the issues",
45        "data": {
46          "outerObject": {
47            "innerObject": {}
48          }
49        },
50        "valid": false,
51        "validationMessages": [
52          "$.outerObject.innerObject: object found, string expected",
53          "$.outerObject.innerObject: required property 'value' not found",
54          "$.outerObject.innerObject: required property 'unit' not found",
55          "$.outerObject.innerObject: must be valid to one and only one schema, but 0 are valid"
56        ]
57      }
58    ]
59  }
60]