This is problematic as the value of minItems inside schema.properties.test is undefined, so when the original object is tested against the generated schema, we have a validation error.
var Validator = require('jsonschema').Validator
const validator = new Validator()
const result = validator.validate(testObj, schema, {throwError: false})
result.errors contains:
[ ValidationError {
property: 'instance.test',
message: 'does not meet minimum length of undefined',
schema:
{ type: 'array',
uniqueItems: undefined,
minItems: undefined,
items: [Object] },
instance: [],
name: 'minItems',
argument: undefined,
stack: 'instance.test does not meet minimum length of undefined' } ]
This outputs:
This is problematic as the value of
minItems
insideschema.properties.test
is undefined, so when the original object is tested against the generated schema, we have a validation error.result.errors contains: