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

Missing objects are not causing errors #5

Merged
merged 2 commits into from
Sep 28, 2012
Merged

Conversation

coryvirok
Copy link
Contributor

var assert = require('assert');
var Validator = require('./lib/validator');

var schema = { 
  required: true,
  type: 'object',
  properties: {
    foo: {
      type: 'object',
      required: true
    }   
  }
};

var validator = new Validator();
var errors = validator.validate({}, schema);
assert(errors.length);

The pull request adds in a check in validateObject() which checks to see if it's required before exiting the function. If it is and the instance is not defined, an error will be added.

tdegrunt added a commit that referenced this pull request Sep 28, 2012
Missing objects are not causing errors
@tdegrunt tdegrunt merged commit 821a0f9 into tdegrunt:master Sep 28, 2012
@tdegrunt
Copy link
Owner

One thing less to implement, thank you! I've bumped the version to 0.1.3 and published.

@coryvirok
Copy link
Contributor Author

Thanks Ted and thanks for the great library! We're making heavy use of it in http://ratchet.io :)

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

Successfully merging this pull request may close these issues.

2 participants