Skip to content

Commit c0c6208

Browse files
committed
Empty array schema should have items property
1 parent b696542 commit c0c6208

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function convert (json, options = {}) {
4545
let schema = {type: 'array'};
4646

4747
if (!json.length) {
48+
schema.items = {};
4849
return schema;
4950
}
5051

test/primitives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('primitives', ()=> {
3232
});
3333

3434
describe('empty array', ()=> {
35-
expect([], {type: 'array'});
35+
expect([], {type: 'array', items: {}});
3636
});
3737

3838
describe('empty object', ()=> {

0 commit comments

Comments
 (0)