SomeType: {
....
nullableItem: {
type: ['null', 'object'],
properties: {
shouldChangeUrl: {
type: 'boolean',
default: false
}
}
}
....
}
and then call validate with useDefault set to true
validator.validate('SomeType', { nullableItem: null }, {useDefault: true});
Expected: validation succeeded.
Actual: validation failed.
This code throws an exception because options.useDefault == true:
if (options.useDefault && hasProp && !malformed) {
for (p in schema.properties)
if (schema.properties.hasOwnProperty(p) && !prop.hasOwnProperty(p) && schema.properties[p].hasOwnProperty('default'))
prop[p] = schema.properties[p]['default'];
}
and then call validate with useDefault set to true
Expected: validation succeeded.
Actual: validation failed.
This code throws an exception because options.useDefault == true: