json-schema-validation-middleware
Validate your incoming requests using a json schema. Tested with restify.
Usage
Create your restify server and your json schema. Adding a validation middleware to an endpoint couldn't be simpler:
var validationMW = ;server;
You can optionally configure the middleware to use a custom error handler:
validationMW;
Formats
The middleware uses the tv4-formats library, so the formats defined there are supported.
Accessing tv4
You can access tv4 directly, for instance to add schema definitions or formatters:
var tv4 = require('json-schema-validation-middleware').tv4;
Development
Style
An .editorconfig
and .jshintrc
enforce a coding style.
Tasks
Gulp is used as a task runner. Install it globally using npm install -g gulp
.
To see a list of gulp commands, run gulp help
.
Git hooks
Upon commiting or pushing, a git hook wil automatically runt code linting or tests.