Officialv5.4.2MITkubb >=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
850.4K/ mo
Stars
8
Bundle size
554.8 kB
Updated
16h ago

@kubb/plugin-zod generates Zod schemas for runtime validation. Enable inferred to export TypeScript types alongside the schemas.

Installation

bun add -d @kubb/plugin-zod

Dependencies

No plugin dependencies. Install Zod v4 or higher in the consuming app. Enable inferred to use schema-derived types without pluginTs.

Example

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

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

Documentation

See also