Skip to content
Zod logo

Zod

Officialv5.13.3

@kubb/plugin-zod

kubb add plugin-zod

How-to guides

5 guides
Coerce input with Zod
Set coercion to convert form data and query strings with z.coerce before Zod validates them, and see which format checks each key turns off.
Compile Zod schemas
Set compile to wrap generated schemas in z.compile(...) for faster validation, and see which schemas stay on the interpreter. Needs Zod 4.5 or later.
Customize generated schemas
Prefix inferred types, change Zod validators, and encode custom request types.
Zod validators for OpenAPI formats
Look up the Zod v4 call Kubb writes for each OpenAPI type and format, such as z.uuid() for format: uuid, and the keywords that add a z.refine check.
Infer TypeScript types from Zod schemas
Set inferred to export a z.infer type next to each Zod schema, or z.input and z.output types for codecs, so you can skip @kubb/plugin-ts.