Validates the given data against the provided schema.

The data to be validated.

The schema to validate against.

  • Returns true if the data is valid, otherwise returns a response object with an error message.

Constructors

Methods

Constructors

Methods

  • Validates the given data against the provided schema.

    Parameters

    • data: any

      The data to be validated.

    • schema: ZodObject<any, UnknownKeysParam, ZodTypeAny, {}, {}> | ZodUnion<any> | ZodIntersection<any, any>

      The schema to validate against.

    Returns boolean | default<ResponseErrorType>

    • Returns either true if the data is valid or a Response object with an error message if validation fails.