The schema (must expose safeParse)
Which request part to validate ('body', 'query', etc.)
The validation service to use
Error formatter (resolved once at registration time)
Optionaloptions: ValidationMiddlewareOptions
Per-validator options; forms: true also validates
urlencoded and multipart bodies (body target only, off by default)
A middleware function
Create a validation middleware function.
The middleware extracts data from the specified request target, validates it via the provided validation service, and either stores the validated value in
ctx.stateand continues the pipeline, or short-circuits with a 400 response containing the formatted validation errors.