validate
validate: (
schemas?,options?) =>Function
Defined in: http/validate.js:48
Creates a JSON Schema validation middleware.
Parameters
Section titled “Parameters”schemas?
Section titled “schemas?”Schema map; each key corresponds to an accumulator property
any
JSON Schema for the parsed request body
params?
Section titled “params?”any
JSON Schema for route path parameters
query?
Section titled “query?”any
JSON Schema for parsed query parameters
options?
Section titled “options?”any = {}
AJV options forwarded to each compiled validator
Returns
Section titled “Returns”Function
- Ergo middleware
(req, res, acc) => voidthat returns{response: {statusCode: 422}}(withdetailanddetailsfrom AJV) on validation failure