Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when 'additionalProperties' is a schema. #106

Open
twitchard opened this issue Sep 16, 2015 · 1 comment
Open

Crashes when 'additionalProperties' is a schema. #106

twitchard opened this issue Sep 16, 2015 · 1 comment

Comments

@twitchard
Copy link

[richard@tigger blah]$ cat blah.js 
var revalidator = require('revalidator')
var object = { 
    foo: 'bar'
}

var schema = { 
    properties: { 
        "baz": { 
            type: 'string',
            required: true
        }
    },
    additionalProperties: 
    {
        type: 'string',
        description: 'This will crash revalidator' 
    },
    type: 'object' }

return revalidator.validate(object, schema)
[richard@tigger blah]$ node blah.js

/home/richard/blah/node_modules/revalidator/lib/revalidator.js:278
    if (schema.format && options.validateFormats) {
              ^
TypeError: Cannot read property 'format' of undefined
    at validateProperty (/home/richard/blah/node_modules/revalidator/lib/revalidator.js:278:15)
    at validateObject (/home/richard/blah/node_modules/revalidator/lib/revalidator.js:232:11)
    at Object.validate (/home/richard/blah/node_modules/revalidator/lib/revalidator.js:35:7)
    at Object.<anonymous> (/home/richard/blah/blah.js:20:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
@twitchard
Copy link
Author

Made PR #105 to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant