Removed strict as schema object option

This commit is contained in:
orangemug 2015-05-07 10:01:14 +01:00
parent 9f802b164c
commit 221191a7c1
2 changed files with 1 additions and 13 deletions

View File

@ -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) {

View File

@ -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({