Allow nullable property of JSON Schema object to be false as well as true. Remove test that asserted failure if nullable was false.
parent
6d4b31e169
commit
28c85ada05
|
@ -70,7 +70,7 @@ function Ajv(opts) {
|
|||
if (opts.formats) addInitialFormats(this);
|
||||
addDefaultMetaSchema(this);
|
||||
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
|
||||
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {const: true}});
|
||||
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: "boolean"}});
|
||||
addInitialSchemas(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -1519,12 +1519,6 @@ describe('Ajv Options', function () {
|
|||
|
||||
testNotNullable({type: ['number']});
|
||||
});
|
||||
|
||||
it('"nullable" keyword must be "true" if present', function() {
|
||||
should.throw(function() {
|
||||
ajv.compile({nullable: false});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('without option "nullable"', function() {
|
||||
|
|
Loading…
Reference in New Issue