Skip to content

withZod

withZod<T>(schema): ParseFn<T>

Defined in: src/adapters/zod.ts:15

Wraps a Zod schema into a ParseFn for use with vereda’s parse option. Uses parseAsync, so schemas with async refinements/transforms work too.

T

ZodType<T>

ParseFn<T>

const UserSchema = z.object({ id: z.number(), name: z.string() });
const ticket = client.get('/users/1', {
parse: withZod(UserSchema),
});