Merge branch 'mattpolzin-nullable-can-be-false'
commit
0cf6e9822d
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
"glob": "^7.0.0",
|
||||
"if-node-version": "^1.0.0",
|
||||
"js-beautify": "^1.7.3",
|
||||
"jshint": "^2.9.4",
|
||||
"jshint": "2.9.7",
|
||||
"json-schema-test": "^2.0.0",
|
||||
"karma": "^3.0.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
|
|
|
@ -1520,9 +1520,15 @@ describe('Ajv Options', function () {
|
|||
testNotNullable({type: ['number']});
|
||||
});
|
||||
|
||||
it('"nullable" keyword must be "true" if present', function() {
|
||||
should.throw(function() {
|
||||
ajv.compile({nullable: false});
|
||||
it('should respect "nullable" == false with opts.nullable == true', function() {
|
||||
testNotNullable({
|
||||
type: 'number',
|
||||
nullable: false
|
||||
});
|
||||
|
||||
testNotNullable({
|
||||
type: ['number'],
|
||||
nullable: false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue