Documentation / @zerotal/validator / validate
Function: validate()
validate<
S>(ctx,factory):Promise<Infer<ExtractDefs<S>>>
Defined in: validator/src/validate.ts:28
Validate the HTTP request body against the given schema.
On success: returns the validated, typed data object (only schema fields). On failure (Inertia or web form): stores errors in session + throws ValidationRedirectError → global handler converts to 303 redirect. On failure (JSON API): throws ValidationJsonError → global handler → 422.
Type Parameters
S
S extends Record<string, FieldRule>
Parameters
ctx
factory
(rules) => S
Returns
Promise<Infer<ExtractDefs<S>>>