validate
validate: (
schemas?,options?) => (req,res,acc) => {response: {detail:string;details?:undefined;statusCode:number; }; } | {response: {detail:any;details:any;statusCode:any; }; } |undefined
Defined in: http/validate.js:61
Creates a JSON Schema validation middleware.
Parameters
Section titled “Parameters”schemas?
Section titled “schemas?”Schema map with direct properties body, query, and/or
params (not nested under a wrapper key). Unrecognized keys emit a per-key-set
ERGO_VALIDATE_UNKNOWN_KEY warning (each unique set of unknown keys warns once)
object
JSON Schema for the parsed request body
params?
Section titled “params?”object
JSON Schema for route path parameters (reads acc.route.params or acc.params)
query?
Section titled “query?”object
JSON Schema for parsed query parameters
options?
Section titled “options?”AJV options forwarded to each compiled validator
formats?
Section titled “formats?”boolean | object | string[]
Format keyword support via
ajv-formats; forwarded to createValidator. Defaults to all standard formats enabled
Returns
Section titled “Returns”(req, res, acc) => { response: { detail: string; details?: undefined; statusCode: number; }; } | { response: { detail: any; details: any; statusCode: any; }; } | undefined