Removed strict as schema object option
This commit is contained in:
parent
9f802b164c
commit
221191a7c1
|
@ -78,7 +78,7 @@ Schema.prototype.validate = function(data, opts) {
|
|||
}
|
||||
}
|
||||
|
||||
if(this.schema.strict || (opts && opts.strict)) {
|
||||
if(opts && opts.strict) {
|
||||
var origKeys = Object.keys(data);
|
||||
|
||||
var diff = origKeys.filter(function(i) {
|
||||
|
|
|
@ -15,18 +15,6 @@ describe("strict schemas", function()
|
|||
expect(input.errors.type).to.equal("Additional key not defined in schema");
|
||||
});
|
||||
|
||||
it("additional keys, strict via schema object", function()
|
||||
{
|
||||
var schema = schemajs.create({
|
||||
strict: true,
|
||||
sound: {type:'string', 'default':'mooo'}
|
||||
});
|
||||
|
||||
var input = schema.validate({sound: 'meow', type: "cat"});
|
||||
expect(input.valid).to.equal(false);
|
||||
expect(input.errors.type).to.equal("Additional key not defined in schema");
|
||||
});
|
||||
|
||||
it("additional keys non strict", function()
|
||||
{
|
||||
var schema = schemajs.create({
|
||||
|
|
Reference in New Issue