1.1.0 • Published 8 months ago

architect-ajv-middleware v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

architect-ajv-middleware

This architect plugin register a middleware to check that the request data matches an AJV schema.

The json schema must be specified in the route spec in the validation attribute:

rest.get({
    url: '/',
    validation: ajvSchema
},
(req, res) => {
    // ...
});

The $id or title attribute on the json schema must be set to enable ajv validator cache.

Installation

npm install --save architect-ajv-middleware

Config Format

{
  "packagePath": "architect-ajv-middleware",
  "ajv": {
    allErrors: true,
    coerceTypes: true,
    useDefaults: true,
    removeAdditional: true
  },
  "http": {
    statusCode: 422,
    code: 'UnprocessableEntity'
  }
}
1.1.0

8 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago