xref: /aosp_15_r20/external/json-schema-validator/src/test/suite/tests/draft3/dependencies.json (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1[
2    {
3        "description": "dependencies",
4        "schema": {
5            "dependencies": {"bar": "foo"}
6        },
7        "tests": [
8            {
9                "description": "neither",
10                "data": {},
11                "valid": true
12            },
13            {
14                "description": "nondependant",
15                "data": {"foo": 1},
16                "valid": true
17            },
18            {
19                "description": "with dependency",
20                "data": {"foo": 1, "bar": 2},
21                "valid": true
22            },
23            {
24                "description": "missing dependency",
25                "data": {"bar": 2},
26                "valid": false
27            },
28            {
29                "description": "ignores arrays",
30                "data": ["bar"],
31                "valid": true
32            },
33            {
34                "description": "ignores strings",
35                "data": "foobar",
36                "valid": true
37            },
38            {
39                "description": "ignores other non-objects",
40                "data": 12,
41                "valid": true
42            }
43        ]
44    },
45    {
46        "description": "multiple dependencies",
47        "schema": {
48            "dependencies": {"quux": ["foo", "bar"]}
49        },
50        "tests": [
51            {
52                "description": "neither",
53                "data": {},
54                "valid": true
55            },
56            {
57                "description": "nondependants",
58                "data": {"foo": 1, "bar": 2},
59                "valid": true
60            },
61            {
62                "description": "with dependencies",
63                "data": {"foo": 1, "bar": 2, "quux": 3},
64                "valid": true
65            },
66            {
67                "description": "missing dependency",
68                "data": {"foo": 1, "quux": 2},
69                "valid": false
70            },
71            {
72                "description": "missing other dependency",
73                "data": {"bar": 1, "quux": 2},
74                "valid": false
75            },
76            {
77                "description": "missing both dependencies",
78                "data": {"quux": 1},
79                "valid": false
80            }
81        ]
82    },
83    {
84        "description": "multiple dependencies subschema",
85        "schema": {
86            "dependencies": {
87                "bar": {
88                    "properties": {
89                        "foo": {"type": "integer"},
90                        "bar": {"type": "integer"}
91                    }
92                }
93            }
94        },
95        "tests": [
96            {
97                "description": "valid",
98                "data": {"foo": 1, "bar": 2},
99                "valid": true
100            },
101            {
102                "description": "no dependency",
103                "data": {"foo": "quux"},
104                "valid": true
105            },
106            {
107                "description": "wrong type",
108                "data": {"foo": "quux", "bar": 2},
109                "valid": false
110            },
111            {
112                "description": "wrong type other",
113                "data": {"foo": 2, "bar": "quux"},
114                "valid": false
115            },
116            {
117                "description": "wrong type both",
118                "data": {"foo": "quux", "bar": "quux"},
119                "valid": false
120            }
121        ]
122    }
123]
124