Skip to content

Commit a9541bb

Browse files
committed
Fix #28: Keep arrays initially empty if min items is 0
1 parent 9f8b79d commit a9541bb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/data.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export function getBlankArray(schema, getRef) {
3939
return schema.default;
4040

4141
let items = [];
42+
43+
let minItems = schema.minItems || schema.min_items || 0;
44+
45+
if (minItems === 0)
46+
return items;
47+
4248
if (schema.items.hasOwnProperty('$ref')) {
4349
// :TODO: this will most probably mutate the original schema
4450
// but i'll fix it later

0 commit comments

Comments
 (0)