diff --git a/index.js b/index.js index f89c908..ba799ce 100644 --- a/index.js +++ b/index.js @@ -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; } diff --git a/test/array-items.test.js b/test/array-items.test.js new file mode 100644 index 0000000..d5e8305 --- /dev/null +++ b/test/array-items.test.js @@ -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'); +});