Skip to content

Zod as the single source of truth

Turn on inferred to export a z.infer alias next to every schema. The schemas then carry the types too, so you drop @kubb/plugin-ts from the config.

kubb.config.ts
typescript
import { 
defineConfig
} from 'kubb/config'
import {
pluginZod
} from '@kubb/plugin-zod'
export default
defineConfig
({
input
: './petStore.yaml',
output
: {
path
: './src/gen',
clean
: true },
plugins
: [
pluginZod
({
inferred
: true,
}), ], })