Decorator to define the Zod validation schema for DTO classes

The Zod schema to use for validation.

A class decorator that applies the schema.

  • Type Parameters

    • T extends ZodType<{ [key: string]: any }, unknown>

    Parameters

    • schema: T

    Returns (target: Class<OmitIndexSignature<T["_output"]>>) => void

  • Type Parameters

    • T extends Readonly<{ [k: string]: $ZodType<unknown, unknown> }>

    Parameters

    • shape: T

    Returns (
        target: Class<
            OmitIndexSignature<$InferObjectOutput<T, Record<string, unknown>>>,
        >,
    ) => void