Skip to content

Commit 444ffa7

Browse files
ivan-tymoshenkojsumners
authored andcommitted
feat: drop array items type checking (#706)
1 parent 2c99bd1 commit 444ffa7

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

test/array.test.js

+2-26
Original file line numberDiff line numberDiff line change
@@ -195,30 +195,6 @@ buildTest({
195195
'@data': ['test']
196196
})
197197

198-
test('invalid items throw', (t) => {
199-
t.plan(1)
200-
const schema = {
201-
type: 'object',
202-
properties: {
203-
args: {
204-
type: 'array',
205-
items: [
206-
{
207-
type: 'object',
208-
patternProperties: {
209-
'.*': {
210-
type: 'string'
211-
}
212-
}
213-
}
214-
]
215-
}
216-
}
217-
}
218-
const stringify = build(schema)
219-
t.throws(() => stringify({ args: ['invalid'] }))
220-
})
221-
222198
buildTest({
223199
title: 'item types in array default to any',
224200
type: 'object',
@@ -329,8 +305,8 @@ test('array items is a list of schema and additionalItems is false /2', (t) => {
329305

330306
const stringify = build(schema)
331307

332-
t.throws(() => stringify({ foo: [1, 'bar'] }), new Error('Item at 0 does not match schema definition.'))
333-
t.throws(() => stringify({ foo: ['foo', 1] }), new Error('Item at 1 does not match schema definition.'))
308+
t.strictSame(stringify({ foo: [1, 'bar'] }), '{"foo":["1","bar"]}')
309+
t.strictSame(stringify({ foo: ['foo', 1] }), '{"foo":["foo","1"]}')
334310
t.throws(() => stringify({ foo: ['foo', 'bar', 'baz'] }), new Error('Item at 2 does not match schema definition.'))
335311
})
336312

0 commit comments

Comments
 (0)