akidee / schema.js

Sophisticated JSON schema based data validation and adaptation
MIT License
173 stars 13 forks source link

TypeError when using minLength #15

Closed BadKnees closed 11 years ago

BadKnees commented 11 years ago

When using minLength i allways get this error: TypeError: Cannot read property 'minLength' of undefined

var register_schema = schemaEnv.Schema.create({
    type: 'object',
    properties: {
        email: {
            type: 'string',
            minLength: 6,
            maxLength: 200,
            optional: false
        }
}

var v = register_schema.validate({email:'bobs@youruncle.com'});

TypeError: Cannot read property 'minLength' of undefined at /usr/local/lib/node_modules/schema/i18n/default.js:23:57 at new (/usr/local/lib/node_modules/schema/lib/validation.js:69:44) at [object Object]. (/usr/local/lib/node_modules/schema/lib/validation.js:205:14) at [object Object].callPlugin (/usr/local/lib/node_modules/schema/lib/validation.js:186:18) at [object Object].minLength (/usr/local/lib/node_modules/schema/lib/draft-02/validation.js:453:12) at [object Object].type (/usr/local/lib/node_modules/schema/lib/draft-02/validation.js:148:22) at [object Object].start (/usr/local/lib/node_modules/schema/lib/draft-02/validation.js:37:20) at [object Object].properties (/usr/local/lib/node_modules/schema/lib/draft-02/validation.js:276:18) at [object Object].type (/usr/local/lib/node_modules/schema/lib/draft-02/validation.js:174:22) at [object Object].start (/usr/local/lib/node_modules/schema/lib/draft-02/validation.js:37:20)

akidee commented 11 years ago

I should have omitted the i18n stuff ... https://github.com/akidee/schema.js/commit/19a16e4806a31e4a255fed83e95ed8f5332372d3