Skip to content

validate

validate: (schemas?, options?) => Function

Defined in: http/validate.js:48

Creates a JSON Schema validation middleware.

Schema map; each key corresponds to an accumulator property

any

JSON Schema for the parsed request body

any

JSON Schema for route path parameters

any

JSON Schema for parsed query parameters

any = {}

AJV options forwarded to each compiled validator

Function

  • Ergo middleware (req, res, acc) => void that returns {response: {statusCode: 422}} (with detail and details from AJV) on validation failure