Debian Codegraph @

spec/extras/$data/enum.json

raw symbols SCIP
1 [
2 {
3 "description": "property is one of values in another property",
4 "schema": {
5 "properties": {
6 "allowedValues": {},
7 "value": {"enum": {"$data": "1/allowedValues"}}
8 }
9 },
10 "tests": [
11 {
12 "description": "one of the enum is valid",
13 "data": {
14 "allowedValues": [1, 2, 3],
15 "value": 1
16 },
17 "valid": true
18 },
19 {
20 "description": "something else is invalid",
21 "data": {
22 "allowedValues": [1, 2, 3],
23 "value": 4
24 },
25 "valid": false
26 },
27 {
28 "description": "heterogeneous enum validation",
29 "data": {
30 "allowedValues": [6, "foo", [], true, {"foo": 12}],
31 "value": {"foo": 12}
32 },
33 "valid": true
34 },
35 {
36 "description": "fail if value of enum is not an array",
37 "data": {
38 "allowedValues": "[1, 2, 3]",
39 "value": 1
40 },
41 "valid": false
42 },
43 {
44 "description": "valid if value of enum is undefined",
45 "data": {
46 "value": 1
47 },
48 "valid": true
49 }
50 ]
51 },
52 {
53 "description": "enum in properties",
54 "schema": {
55 "properties": {
56 "allowedValues": {}
57 },
58 "additionalProperties": {
59 "enum": {"$data": "1/allowedValues"}
60 }
61 },
62 "tests": [
63 {
64 "description": "properties are valid",
65 "data": {
66 "allowedValues": ["foo", "bar"],
67 "a": "foo",
68 "b": "bar"
69 },
70 "valid": true
71 },
72 {
73 "description": "properties are invalid",
74 "data": {
75 "allowedValues": ["foo", "bar"],
76 "a": "foo",
77 "b": "baz"
78 },
79 "valid": false
80 }
81 ]
82 }
83 ]