File tree Expand file tree Collapse file tree 1 file changed +90
-0
lines changed Expand file tree Collapse file tree 1 file changed +90
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,51 @@ public function getInvalidTests()
71
71
}
72
72
}
73
73
} '
74
+ ),
75
+ array ( // Test array items.enum where type string fail validation if value(s) is/are not in items.enum
76
+ '{"data": ["a", "b"]} ' ,
77
+ '{
78
+ "type": "object",
79
+ "properties": {
80
+ "data": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "string",
84
+ "enum": ["b", "c"]
85
+ }
86
+ }
87
+ }
88
+ } '
89
+ ),
90
+ array ( // Test array items.enum where type integer fail validation if value(s) is/are not in items.enum
91
+ '{"data": [1, 2]} ' ,
92
+ '{
93
+ "type": "object",
94
+ "properties": {
95
+ "data": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "integer",
99
+ "enum": [2, 3]
100
+ }
101
+ }
102
+ }
103
+ } '
104
+ ),
105
+ array ( // Test array items.enum where type number fail validation if value(s) is/are not in items.enum
106
+ '{"data": [1.25, 2.25]} ' ,
107
+ '{
108
+ "type": "object",
109
+ "properties": {
110
+ "data": {
111
+ "type": "array",
112
+ "items": {
113
+ "type": "number",
114
+ "enum": [1.25, 2]
115
+ }
116
+ }
117
+ }
118
+ } '
74
119
)
75
120
);
76
121
}
@@ -168,6 +213,51 @@ public function getValidTests()
168
213
}
169
214
}
170
215
} '
216
+ ),
217
+ array ( // Test array items.enum where type string passes validation if value(s) is/are in items.enum
218
+ '{"data": ["c", "c", "b"]} ' ,
219
+ '{
220
+ "type": "object",
221
+ "properties": {
222
+ "data": {
223
+ "type": "array",
224
+ "items": {
225
+ "type": "string",
226
+ "enum": ["b", "c"]
227
+ }
228
+ }
229
+ }
230
+ } '
231
+ ),
232
+ array ( // Test array items.enum where type integer passes validation if value(s) is/are in items.enum
233
+ '{"data": [1, 1, 2]} ' ,
234
+ '{
235
+ "type": "object",
236
+ "properties": {
237
+ "data": {
238
+ "type": "array",
239
+ "items": {
240
+ "type": "integer",
241
+ "enum": [1, 2]
242
+ }
243
+ }
244
+ }
245
+ } '
246
+ ),
247
+ array ( // Test array items.enum where type number passes validation if value(s) is/are in items.enum
248
+ '{"data": [1.25, 1.25, 2.25]} ' ,
249
+ '{
250
+ "type": "object",
251
+ "properties": {
252
+ "data": {
253
+ "type": "array",
254
+ "items": {
255
+ "type": "number",
256
+ "enum": [1.25, 2.25]
257
+ }
258
+ }
259
+ }
260
+ } '
171
261
)
172
262
);
173
263
}
You can’t perform that action at this time.
0 commit comments