xref: /aosp_15_r20/external/json-schema-validator/src/test/resources/schema/issue664-v7.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1{
2  "$schema": "http://json-schema.org/draft-07/schema#",
3  "type": "array",
4  "items": {
5    "type": "object",
6    "required": [
7      "country",
8      "postal_code"
9    ],
10    "properties": {
11      "country": {
12        "type": "string"
13      },
14      "postal_code": {
15        "type": "string"
16      }
17    },
18    "allOf": [
19      {
20        "anyOf": [
21          {
22            "oneOf": [
23              {
24                "not": {
25                  "properties": {
26                    "country": {
27                      "const": "United Kingdom"
28                    }
29                  }
30                }
31              }
32            ]
33          }
34        ]
35      },
36      {
37        "if": {
38          "properties": {
39            "country": {
40              "const": "United States of America"
41            }
42          }
43        },
44        "then": {
45          "properties": {
46            "postal_code": {
47              "pattern": "[0-9]{5}(-[0-9]{4})?"
48            }
49          }
50        },
51        "else": {
52          "properties": {
53            "postal_code": {
54              "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]"
55            }
56          }
57        }
58      }
59    ]
60  }
61}