restify-ajv-middleware
A json-schema validation middleware for restify using ajv. Inspired by restify-joi-middleware
Installation
npm install restify-ajv-middleware --save
Usage
const restify = const validator = const server = restify server server;
Options
- keysToValidate: override the default keys to validate against
server
- errorResponder: a function in the form
(transformedErr, req, res, next)
used to modify the default response strategy after failed validation.
server
- errorTransformer: a function in the form
(validationInput, errors)
, used to transform the error generated after failed validation
server
- ajv: options passed to the internal ajv instance. See options for more info.