xref: /aosp_15_r20/external/json-schema-validator/src/test/resources/draft4/enumObject.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2  {
3    "description": "simple enum object validation",
4    "schema": {
5      "properties": {
6        "foo": {
7          "type": "object",
8          "enum": [
9            1,
10            2,
11            3
12          ]
13        },
14        "bar": {
15          "$ref": "#/properties/foo"
16        }
17      }
18    },
19    "tests": [
20      {
21        "description": "one of the enum is valid",
22        "data": {
23          "bar": 1
24        },
25        "valid": true
26      },
27      {
28        "description": "one of the enum is valid",
29        "isTypeLoose": true,
30        "data": {
31          "bar": "1"
32        },
33        "valid": true
34      },
35      {
36        "description": "something else is invalid",
37        "isTypeLoose": false,
38        "data": {
39          "bar": "1"
40        },
41        "valid": false
42      },
43      {
44        "description": "something else is invalid",
45        "data": {
46          "bar": 4
47        },
48        "valid": false
49      }
50    ]
51  },
52  {
53    "description": "fake enum object validation",
54    "schema": {
55      "type": "object",
56      "enum": [
57        1,
58        2,
59        {
60          "key": "value"
61        }
62      ]
63    },
64    "tests": [
65      {
66        "description": "one of the enum is invalid",
67        "data": 1,
68        "valid": false
69      },
70      {
71        "description": "one of the enum is valid",
72        "isTypeLoose": true,
73        "data": {
74          "key": "value"
75        },
76        "valid": true
77      }
78    ]
79  }
80]
81