Skip to content

mikanda/schema-validate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

schema-validate

Validator to validate a model against a json schema.

Installation

Install with component(1):

$ component install mikanda/schema-validate

Usage

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);

API

SchemaValidate()

Initializes a new validator.

License

MIT

About

Validator to validate a model against a json schema.

Resources

Stars

Watchers

Forks

Packages

No packages published