Skip to content
Officialv5.4.6MITkubb >=5.0.0node >=22

@kubb/plugin-zod

Generates Zod v4 schemas from your OpenAPI spec so you validate API responses, form input, and query params at runtime.

zodvalidationschemaruntime-validationcodegenopenapi
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
923.8K/ mo
Stars
8
Bundle size
564.3 kB
Updated
39m ago

Generate Zod schemas for runtime validation.

  • Export TypeScript types with inferred: true, without pluginTs.

Installation

bun add -d @kubb/plugin-zod

Or run kubb add plugin-zod to install the version the Kubb registry pins and add pluginZod() to kubb.config.ts.

Dependencies

  • No plugin dependencies.
  • Install Zod v4 or higher in the consuming app.

Example

kubb.config.ts
import { defineConfig } from 'kubb/config'
import { pluginZod } from '@kubb/plugin-zod'

export default defineConfig({
  input: './petStore.yaml',
  output: { path: './src/gen' },
  plugins: [
    pluginZod({ inferred: true }),
  ],
})

See also