@@ -20,6 +20,10 @@ const schema = {
20
20
requiredBoolean : Type . Boolean . required ,
21
21
date : Type . Date ,
22
22
requiredDate : Type . Date . required ,
23
+ emptyArrayOfStrings : Type . Array . of ( Type . String ) ,
24
+ emptyArrayOfNumbers : Type . Array . of ( Type . Number ) ,
25
+ emptyArrayOfBooleans : Type . Array . of ( Type . Boolean ) ,
26
+ emptyArrayOfDates : Type . Array . of ( Type . Date ) ,
23
27
arrayOfString : Type . Array . of ( Type . String ) ,
24
28
arrayOfNumber : Type . Array . of ( Type . Number ) ,
25
29
arrayOfBoolean : Type . Array . of ( Type . Boolean ) ,
@@ -78,6 +82,30 @@ const invalidDataErrors = [{
78
82
message : 'must match format "iso-date-time"' ,
79
83
params : { format : 'iso-date-time' } ,
80
84
schemaPath : '#/properties/date/format' ,
85
+ } , {
86
+ instancePath : '/emptyArrayOfStrings' ,
87
+ keyword : 'type' ,
88
+ message : 'must be array' ,
89
+ params : { type : 'array' } ,
90
+ schemaPath : '#/properties/emptyArrayOfStrings/type' ,
91
+ } , {
92
+ instancePath : '/emptyArrayOfNumbers' ,
93
+ keyword : 'type' ,
94
+ message : 'must be array' ,
95
+ params : { type : 'array' } ,
96
+ schemaPath : '#/properties/emptyArrayOfNumbers/type' ,
97
+ } , {
98
+ instancePath : '/emptyArrayOfBooleans' ,
99
+ keyword : 'type' ,
100
+ message : 'must be array' ,
101
+ params : { type : 'array' } ,
102
+ schemaPath : '#/properties/emptyArrayOfBooleans/type' ,
103
+ } , {
104
+ instancePath : '/emptyArrayOfDates' ,
105
+ keyword : 'type' ,
106
+ message : 'must be array' ,
107
+ params : { type : 'array' } ,
108
+ schemaPath : '#/properties/emptyArrayOfDates/type' ,
81
109
} , {
82
110
instancePath : '/arrayOfString/0' ,
83
111
keyword : 'type' ,
@@ -163,6 +191,10 @@ test('.compile(schema) has the given schema associated with it', t => {
163
191
requiredBoolean : { type : 'boolean' } ,
164
192
date : { type : 'string' , format : 'iso-date-time' } ,
165
193
requiredDate : { type : 'string' , format : 'iso-date-time' } ,
194
+ emptyArrayOfStrings : { type : 'array' , items : { type : 'string' } } ,
195
+ emptyArrayOfNumbers : { type : 'array' , items : { type : 'number' } } ,
196
+ emptyArrayOfBooleans : { type : 'array' , items : { type : 'boolean' } } ,
197
+ emptyArrayOfDates : { type : 'array' , items : { type : 'string' , format : 'iso-date-time' } } ,
166
198
arrayOfString : { type : 'array' , items : { type : 'string' } } ,
167
199
arrayOfNumber : { type : 'array' , items : { type : 'number' } } ,
168
200
arrayOfBoolean : { type : 'array' , items : { type : 'boolean' } } ,
@@ -236,6 +268,24 @@ test('.compile(MainModel) has the given schema associated with it', t => {
236
268
requiredArrayOfNumber : { type : 'array' , items : { type : 'number' } } ,
237
269
requiredArrayOfBoolean : { type : 'array' , items : { type : 'boolean' } } ,
238
270
requiredArrayOfDate : { type : 'array' , items : { type : 'string' , format : 'iso-date-time' } } ,
271
+ emptyArrayOfStrings : { type : 'array' , items : { type : 'string' } } ,
272
+ emptyArrayOfNumbers : { type : 'array' , items : { type : 'number' } } ,
273
+ emptyArrayOfBooleans : { type : 'array' , items : { type : 'boolean' } } ,
274
+ emptyArrayOfDates : { type : 'array' , items : { type : 'string' , format : 'iso-date-time' } } ,
275
+ emptyArrayOfModels : {
276
+ type : 'array' ,
277
+ items : {
278
+ type : 'object' ,
279
+ additionalProperties : false ,
280
+ required : [ 'id' ] ,
281
+ properties : {
282
+ id : {
283
+ type : 'string' ,
284
+ pattern : '^LinkedManyModel/[A-Z0-9]+$' ,
285
+ } ,
286
+ } ,
287
+ } ,
288
+ } ,
239
289
requiredLinked : {
240
290
type : 'object' ,
241
291
additionalProperties : false ,
0 commit comments