Validator to validate a model against a json schema.
Install with component(1):
$ component install mikanda/schema-validate
var model = require('model')
, schemaValidate = require('schema-validate');
var User = model('user')
.use(schemaValidate())
// define your attributes using json-schema
.attr('name', {
type: 'string',
required: true
})
...
;
var user = new User({ ... });
user.validate();
// console.log(user.errors);
Initializes a new validator.
MIT