estephinson / zod-wretch

A small library bringing in Zod Schema parsing to the Wretch callchain
0 stars 1 forks source link

Zod Wretch

zod-wretch is a small utility library for elbywan/wretch to bring in first-class support for zod schema validation.

import { ZodAddon } from 'zod-wretch';
import wretch from 'wretch';

const api = wretch().addon(ZodAddon);

// ...

const TestSchema = z.object({
    message: z.string(),
});

const response = await api.get("/test").jsonSchema(TestSchema);