function ValidateBody
Since 0.1.0
ValidateBody(schema: unknown): SetuMethodDecorator

Attaches a request body schema to the decorated route handler.

The schema is enforced (invalid bodies answered with 400) when a CAPABILITIES.VALIDATION provider is registered and enforceSchemas is not false; otherwise it remains description-only. See the module documentation.

Parameters

schema: unknown

Validation schema (Zod schema by convention)

Return Type

A method decorator

Usage

import { ValidateBody } from "decorator-plugin/src/index.ts";