Debian Codegraph @

share/tests/v1/proposals/propertyDependencies/dynamicRef.json

raw
1 [
2 {
3 "description": "multiple dynamic paths to the $dynamicRef keyword",
4 "schema": {
5 "$schema": "https://json-schema.org/v1",
6 "$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
7 "propertyDependencies": {
8 "kindOfList": {
9 "numbers": { "$ref": "numberList" },
10 "strings": { "$ref": "stringList" }
11 }
12 },
13 "$defs": {
14 "genericList": {
15 "$id": "genericList",
16 "properties": {
17 "list": {
18 "items": { "$dynamicRef": "#itemType" }
19 }
20 }
21 },
22 "numberList": {
23 "$id": "numberList",
24 "$defs": {
25 "itemType": {
26 "$dynamicAnchor": "itemType",
27 "type": "number"
28 }
29 },
30 "$ref": "genericList"
31 },
32 "stringList": {
33 "$id": "stringList",
34 "$defs": {
35 "itemType": {
36 "$dynamicAnchor": "itemType",
37 "type": "string"
38 }
39 },
40 "$ref": "genericList"
41 }
42 }
43 },
44 "tests": [
45 {
46 "description": "number list with number values",
47 "data": {
48 "kindOfList": "numbers",
49 "list": [1.1]
50 },
51 "valid": true
52 },
53 {
54 "description": "number list with string values",
55 "data": {
56 "kindOfList": "numbers",
57 "list": ["foo"]
58 },
59 "valid": false
60 },
61 {
62 "description": "string list with number values",
63 "data": {
64 "kindOfList": "strings",
65 "list": [1.1]
66 },
67 "valid": false
68 },
69 {
70 "description": "string list with string values",
71 "data": {
72 "kindOfList": "strings",
73 "list": ["foo"]
74 },
75 "valid": true
76 }
77 ]
78 },
79 {
80 "description": "$dynamicAnchor inside propertyDependencies",
81 "schema": {
82 "$schema": "https://json-schema.org/v1",
83 "$id": "http://localhost:1234/v1/dynamicanchor-in-propertydependencies.json",
84 "$defs": {
85 "inner": {
86 "$id": "inner",
87 "$dynamicAnchor": "foo",
88 "type": "object",
89 "properties": {
90 "expectedTypes": {
91 "type": "string"
92 }
93 },
94 "additionalProperties": {
95 "$dynamicRef": "#foo"
96 }
97 }
98 },
99 "propertyDependencies": {
100 "expectedTypes": {
101 "strings": {
102 "$id": "east",
103 "$ref": "inner",
104 "$defs": {
105 "foo": {
106 "$dynamicAnchor": "foo",
107 "type": "string"
108 }
109 }
110 },
111 "integers": {
112 "$id": "west",
113 "$ref": "inner",
114 "$defs": {
115 "foo": {
116 "$dynamicAnchor": "foo",
117 "type": "integer"
118 }
119 }
120 }
121 }
122 }
123 },
124 "tests": [
125 {
126 "description": "expected strings - additional property as string is valid",
127 "data": {
128 "expectedTypes": "strings",
129 "anotherProperty": "also a string"
130 },
131 "valid": true
132 },
133 {
134 "description": "expected strings - additional property as not string is invalid",
135 "data": {
136 "expectedTypes": "strings",
137 "anotherProperty": 42
138 },
139 "valid": false
140 },
141 {
142 "description": "expected integers - additional property as integer is valid",
143 "data": {
144 "expectedTypes": "integers",
145 "anotherProperty": 42
146 },
147 "valid": true
148 },
149 {
150 "description": "expected integers - additional property as not integer is invalid",
151 "data": {
152 "expectedTypes": "integers",
153 "anotherProperty": "a string"
154 },
155 "valid": false
156 }
157 ]
158 }
159 ]