Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ function convertSchema(schema, path, parent, parentPath) {
schema = convertPatternProperties(schema);
}

if (schema.type === 'array' && typeof schema.items === 'undefined') {
schema.items = {};
}

return schema;
}

Expand Down
21 changes: 21 additions & 0 deletions test/array-items.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

const convert = require('../');
const should = require('should');

it('array-items', () => {
const schema = {
$schema: 'http://json-schema.org/draft-04/schema#',
type: 'array',
};

const result = convert(schema);

const expected = {
type: 'array',
items: {
}
};

should(result).deepEqual(expected, 'converted');
});