@kubb/plugin-zod 5.0.0-beta.56 → 5.0.0-beta.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ast","File","Type","Const","File","Const","Type","ast","strictOneOfMember","ast","ast","jsxRenderer","ast","File"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../src/components/Operations.tsx","../src/components/Zod.tsx","../src/constants.ts","../src/utils.ts","../src/printers/printerZod.ts","../src/printers/printerZodMini.ts","../src/generators/zodGenerator.tsx","../src/resolvers/resolverZod.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n .filter(Boolean)\n .join('/')\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n","import { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.resolveFile`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n }\n\n return node.path ? `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}` : null\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type — a binary type\n * (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`, `video/*`) maps to `'blob'`\n * and other `text/*` maps to `'text'`. Otherwise `undefined`, leaving the runtime client's\n * `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n\n const baseType = contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nexport function getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isSuccessStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\n/**\n * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.\n * Each member is `{ status: N; data: StatusNType; statusText: string }`.\n */\nexport function buildStatusUnionType(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string {\n const members = node.responses.map((r) => {\n const typeName = resolver.resolveResponseStatusName(node, r.statusCode)\n const statusCode = Number.parseInt(r.statusCode, 10)\n const statusLiteral = Number.isNaN(statusCode) ? 'number' : String(statusCode)\n return `{ status: ${statusLiteral}; data: ${typeName}; statusText: string }`\n })\n if (members.length === 1) return members[0]!\n return `(${members.join(' | ')})`\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { stringifyObject } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype SchemaNames = {\n request: string | null\n parameters: {\n path: string | null\n query: string | null\n header: string | null\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype Props = {\n name: string\n operations: Array<{ node: ast.OperationNode; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbReactNode {\n const operationsJSON = operations.reduce<Record<string, unknown>>(\n (prev, acc) => {\n prev[`\"${acc.node.operationId}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce<Record<string, Record<string, string>>>((prev, acc) => {\n if (!ast.isHttpOperationNode(acc.node)) return prev\n prev[`\"${acc.node.path}\"`] = {\n ...(prev[`\"${acc.node.path}\"`] ?? {}),\n [acc.node.method]: `operations[\"${acc.node.operationId}\"]`,\n }\n\n return prev\n }, {})\n\n return (\n <>\n <File.Source name=\"OperationSchema\" isExportable isIndexable>\n <Type name=\"OperationSchema\" export>{`{\n readonly request: z.ZodTypeAny | undefined;\n readonly parameters: {\n readonly path: z.ZodTypeAny | undefined;\n readonly query: z.ZodTypeAny | undefined;\n readonly header: z.ZodTypeAny | undefined;\n };\n readonly responses: {\n readonly [status: number]: z.ZodTypeAny;\n readonly default: z.ZodTypeAny;\n };\n readonly errors: {\n readonly [status: number]: z.ZodTypeAny;\n };\n}`}</Type>\n </File.Source>\n <File.Source name=\"OperationsMap\" isExportable isIndexable>\n <Type name=\"OperationsMap\" export>\n {'Record<string, OperationSchema>'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} asConst>\n {`{${stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PrinterZodFactory } from '../printers/printerZod.ts'\nimport type { PrinterZodMiniFactory } from '../printers/printerZodMini.ts'\n\ntype Props = {\n name: string\n node: ast.SchemaNode\n /**\n * Pre-configured printer instance created by the generator.\n * The generator selects `printerZod` or `printerZodMini` based on the `mini` option,\n * then merges in any user-supplied `printer.nodes` overrides.\n */\n printer: ast.Printer<PrinterZodFactory> | ast.Printer<PrinterZodMiniFactory>\n inferTypeName?: string | null\n}\n\nexport function Zod({ name, node, printer, inferTypeName }: Props): KubbReactNode {\n const output = printer.print(node)\n\n if (!output) {\n return\n }\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name}>\n {output}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n </File.Source>\n )}\n </>\n )\n}\n","/**\n * Import paths that use a namespace import (`import * as z from '...'`).\n * All other import paths use a named import (`import { z } from '...'`).\n */\nexport const ZOD_NAMESPACE_IMPORTS = new Set(['zod', 'zod/mini'] as const)\n","import { extractRefName, stringify, toRegExpString } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from './types.ts'\n\n/**\n * Returns `true` when the given coercion option enables coercion for the specified type.\n */\nexport function shouldCoerce(coercion: PluginZod['resolvedOptions']['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean {\n if (coercion === undefined || coercion === false) return false\n if (coercion === true) return true\n\n return !!coercion[type]\n}\n\n/**\n * A codec for a schema node whose runtime type differs from its JSON wire type:\n * the output (response) schema decodes wire → runtime, and the input (request)\n * variant encodes runtime → wire.\n *\n * To support another codec type, append a `Codec` to `codecs` and route that\n * type's printer node handler through `getCodec`.\n */\nexport type Codec = {\n /**\n * Whether this node is encoded/decoded by this codec.\n */\n matches(node: ast.SchemaNode): boolean\n /**\n * Output direction (response): decode the wire value into the runtime type.\n */\n decode(node: ast.SchemaNode): string\n /**\n * Input direction (request): encode the runtime value back to the wire value.\n */\n encode(node: ast.SchemaNode): string\n}\n\n/**\n * `dateType: 'date'` fields are typed as `Date` but travel as ISO `string`s.\n * Output decodes `string → Date`; input encodes `Date → string`, preserving the\n * `date` (`YYYY-MM-DD`) vs `date-time` precision carried on `node.format`.\n */\nconst dateCodec: Codec = {\n matches(node) {\n return node.type === 'date' && node.representation === 'date'\n },\n decode(node) {\n return node.format === 'date' ? 'z.iso.date().transform((value) => new Date(value))' : 'z.iso.datetime().transform((value) => new Date(value))'\n },\n encode(node) {\n return node.format === 'date' ? 'z.date().transform((value) => value.toISOString().slice(0, 10))' : 'z.date().transform((value) => value.toISOString())'\n },\n}\n\n/**\n * Registered codecs, checked in order.\n */\nconst codecs: Array<Codec> = [dateCodec]\n\n/**\n * Returns the codec for this node, or `undefined` when the node needs no\n * encode/decode (its wire and runtime types match).\n */\nexport function getCodec(node: ast.SchemaNode | undefined): Codec | undefined {\n if (!node) return undefined\n return codecs.find((codec) => codec.matches(node))\n}\n\n/**\n * Returns `true` when the node itself is encoded/decoded by a codec.\n */\nexport function hasCodec(node: ast.SchemaNode | undefined): boolean {\n return getCodec(node) !== undefined\n}\n\n/**\n * Returns `true` when the schema transitively contains a codec node —\n * a value whose runtime type differs from its wire type (see {@link hasCodec}),\n * so it must be decoded (response) or encoded (request) at the validation boundary.\n * `$ref`s are followed via their resolved schema; a `seen` set guards cycles.\n */\nexport function containsCodec(node: ast.SchemaNode | undefined, seen: Set<string> = new Set()): boolean {\n if (!node) return false\n\n if (hasCodec(node)) return true\n\n if (node.type === 'ref') {\n if (!node.ref) return false\n const refName = extractRefName(node.ref)\n if (refName) {\n if (seen.has(refName)) return false\n seen.add(refName)\n }\n const resolved = ast.syncSchemaRef(node)\n if (resolved.type === 'ref') return false\n return containsCodec(resolved, seen)\n }\n\n const children: Array<ast.SchemaNode | undefined> = []\n if ('properties' in node && node.properties) children.push(...node.properties.map((prop) => prop.schema))\n if ('items' in node && node.items) children.push(...node.items)\n if ('members' in node && node.members) children.push(...node.members)\n if ('additionalProperties' in node && node.additionalProperties && node.additionalProperties !== true) children.push(node.additionalProperties)\n\n return children.some((child) => containsCodec(child, seen))\n}\n\n/**\n * Collects all resolved schema names for an operation's parameters and responses\n * into a single lookup object, useful for building imports and type references.\n */\nexport function buildSchemaNames(node: ast.OperationNode, { params, resolver }: { params: Array<ast.ParameterNode>; resolver: ResolverZod }) {\n const pathParam = params.find((p) => p.in === 'path')\n const queryParam = params.find((p) => p.in === 'query')\n const headerParam = params.find((p) => p.in === 'header')\n\n const responses: Record<number | string, string> = {}\n const errors: Record<number | string, string> = {}\n\n for (const res of node.responses) {\n const name = resolver.resolveResponseStatusName(node, res.statusCode)\n const statusNum = Number(res.statusCode)\n\n if (!Number.isNaN(statusNum)) {\n responses[statusNum] = name\n if (statusNum >= 400) {\n errors[statusNum] = name\n }\n }\n }\n\n responses['default'] = resolver.resolveResponseName(node)\n\n return {\n request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null,\n parameters: {\n path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : null,\n query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : null,\n header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : null,\n },\n responses,\n errors,\n }\n}\n\n/**\n * Format a default value as a code-level literal.\n * Objects become `{}`, primitives become their string representation, strings are quoted.\n */\nexport function formatDefault(value: unknown): string {\n if (typeof value === 'string') return stringify(value)\n if (typeof value === 'object' && value !== null) return '{}'\n\n return String(value ?? '')\n}\n\n/**\n * Format a primitive enum/literal value.\n * Strings are quoted; numbers and booleans are emitted raw.\n */\nexport function formatLiteral(v: string | number | boolean): string {\n if (typeof v === 'string') return stringify(v)\n\n return String(v)\n}\n\n/**\n * Numeric constraint limits for Zod schemas (min, max, and exclusive bounds).\n */\nexport type NumericConstraints = {\n min?: number\n max?: number\n exclusiveMinimum?: number\n exclusiveMaximum?: number\n multipleOf?: number\n}\n\n/**\n * Length constraint limits for string and array schemas (min, max, and regex pattern).\n */\nexport type LengthConstraints = {\n min?: number\n max?: number\n pattern?: string\n}\n\n/**\n * Modifier options for applying chainable methods to Zod schema values.\n */\nexport type ModifierOptions = {\n value: string\n nullable?: boolean\n optional?: boolean\n nullish?: boolean\n defaultValue?: unknown\n description?: string\n}\n\n/**\n * Build `.min()` / `.max()` / `.gt()` / `.lt()` constraint chains for numbers\n * using the standard chainable Zod v4 API.\n */\nexport function numberConstraints({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : '',\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : '',\n multipleOf !== undefined ? `.multipleOf(${multipleOf})` : '',\n ].join('')\n}\n\n/**\n * Build `.min()` / `.max()` / `.regex()` chains for strings/arrays\n * using the standard chainable Zod v4 API.\n */\nexport function lengthConstraints({ min, max, pattern }: LengthConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n pattern !== undefined ? `.regex(${toRegExpString(pattern, null)})` : '',\n ].join('')\n}\n\n/**\n * Build `.check(z.minimum(), z.maximum())` for `zod/mini` numeric constraints.\n */\nexport function numberChecksMini({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n const checks: Array<string> = []\n if (min !== undefined) checks.push(`z.minimum(${min})`)\n if (max !== undefined) checks.push(`z.maximum(${max})`)\n if (exclusiveMinimum !== undefined) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`)\n if (exclusiveMaximum !== undefined) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`)\n if (multipleOf !== undefined) checks.push(`z.multipleOf(${multipleOf})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Build `.check(z.minLength(), z.maxLength(), z.regex())` for `zod/mini` length constraints.\n */\nexport function lengthChecksMini({ min, max, pattern }: LengthConstraints): string {\n const checks: Array<string> = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n if (pattern !== undefined) checks.push(`z.regex(${toRegExpString(pattern, null)})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Apply nullable / optional / nullish modifiers and an optional `.describe()` call\n * to a schema value string using the chainable Zod v4 API.\n */\nexport function applyModifiers({ value, nullable, optional, nullish, defaultValue, description }: ModifierOptions): string {\n const withModifier = (() => {\n if (nullish || (nullable && optional)) return `${value}.nullish()`\n if (optional) return `${value}.optional()`\n if (nullable) return `${value}.nullable()`\n return value\n })()\n const withDefault = defaultValue !== undefined ? `${withModifier}.default(${formatDefault(defaultValue)})` : withModifier\n return description ? `${withDefault}.describe(${stringify(description)})` : withDefault\n}\n\n/**\n * Apply nullable / optional / nullish modifiers using the functional `zod/mini` API\n * (`z.nullable()`, `z.optional()`, `z.nullish()`).\n */\nexport function applyMiniModifiers({ value, nullable, optional, nullish, defaultValue }: Omit<ModifierOptions, 'description'>): string {\n const withModifier = (() => {\n if (nullish) return `z.nullish(${value})`\n const withNullable = nullable ? `z.nullable(${value})` : value\n return optional ? `z.optional(${withNullable})` : withNullable\n })()\n return defaultValue !== undefined ? `z._default(${withModifier}, ${formatDefault(defaultValue)})` : withModifier\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ast.ParameterNode>\n optional?: boolean\n}\n\n/**\n * Builds an `object` schema node grouping the given parameter nodes.\n * The `primitive: 'object'` marker ensures the Zod printer emits `z.object(…)` rather than a record.\n */\nexport function buildGroupedParamsSchema({ params, optional }: BuildGroupedParamsSchemaOptions): ast.SchemaNode {\n return ast.createSchema({\n type: 'object',\n optional,\n primitive: 'object',\n properties: params.map((param) =>\n ast.createProperty({\n name: param.name,\n required: param.required,\n schema: param.schema,\n }),\n ),\n })\n}\n","import { buildList, buildObject, extractRefName, objectKey, stringify } from '@kubb/ast/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyModifiers, containsCodec, formatLiteral, getCodec, lengthConstraints, numberConstraints, shouldCoerce } from '../utils.ts'\nimport type { AdapterOas } from '@kubb/adapter-oas'\n\n/**\n * Partial map of node-type overrides for the Zod printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.string().date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodNodes = ast.PrinterPartial<string, PrinterZodOptions>\n\nexport type PrinterZodOptions = {\n /**\n * Enable automatic type coercion for strings, numbers, and dates.\n */\n coercion?: PluginZod['resolvedOptions']['coercion']\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Date format in the OpenAPI spec (`'date'` or `'date-time'`).\n */\n dateType?: AdapterOas['resolvedOptions']['dateType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Print direction for `dateType: 'date'` fields (`Date` in TypeScript):\n * - `'output'` (default) — decode the wire `string` into a `Date` (response bodies).\n * - `'input'` — encode a `Date` back into the wire `string` (request bodies/params).\n *\n * Diverging the directions requires the generator to emit an `${name}InputSchema`\n * variant for each date-bearing component.\n */\n direction?: 'input' | 'output'\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodNodes\n}\n\n/**\n * Factory options for the Zod printer, defining input/output types and configuration.\n */\nexport type PrinterZodFactory = ast.PrinterFactoryOptions<'zod', PrinterZodOptions, string, string>\n\nfunction strictOneOfMember(member: string, node: ast.SchemaNode): string {\n if (node.type === 'object' && node.additionalProperties === undefined) {\n return `${member}.strict()`\n }\n\n if (node.type === 'ref') {\n if (member.startsWith('z.lazy(')) {\n return member\n }\n\n const schema = ast.syncSchemaRef(node)\n\n if (schema.type === 'object' && (schema.additionalProperties === undefined || schema.additionalProperties === false)) {\n return `${member}.strict()`\n }\n }\n\n return member\n}\n\nfunction getMemberConstraint(member: ast.SchemaNode): string | undefined {\n if (member.primitive === 'string') return lengthConstraints(ast.narrowSchema(member, 'string') ?? {}) || undefined\n if (member.primitive === 'number' || member.primitive === 'integer')\n return numberConstraints(ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer') ?? {}) || undefined\n if (member.primitive === 'array') return lengthConstraints(ast.narrowSchema(member, 'array') ?? {}) || undefined\n}\n\n/**\n * Zod v4 printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the chainable API\n * (`.optional()`, `.nullable()`, `.omit()`, etc.). For improved tree-shaking, see {@link printerZodMini}.\n *\n * @example Chainable API\n * ```ts\n * const printer = printerZod({ coercion: false })\n * const code = printer.print(stringNode) // \"z.string()\"\n * ```\n */\nexport const printerZod = ast.definePrinter<PrinterZodFactory>((options) => {\n return {\n name: 'zod',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n const base = shouldCoerce(this.options.coercion, 'strings') ? 'z.coerce.string()' : 'z.string()'\n\n return `${base}${lengthConstraints(node)}`\n },\n number(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number()' : 'z.number()'\n\n return `${base}${numberConstraints(node)}`\n },\n integer(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number().int()' : 'z.int()'\n\n return `${base}${numberConstraints(node)}`\n },\n bigint() {\n return shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.bigint()' : 'z.bigint()'\n },\n date(node) {\n // representation: 'date' → typed as `Date`; decode/encode at the boundary.\n const codec = getCodec(node)\n if (codec) {\n return this.options.direction === 'input' ? codec.encode(node) : codec.decode(node)\n }\n\n return 'z.iso.date()'\n },\n datetime(node) {\n const offset = node.offset || this.options.dateType === 'stringOffset'\n const local = node.local || this.options.dateType === 'stringLocal'\n\n if (offset) return 'z.iso.datetime({ offset: true })'\n if (local) return 'z.iso.datetime({ local: true })'\n\n return 'z.iso.datetime()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthConstraints(node)}`\n },\n email(node) {\n return `z.email()${lengthConstraints(node)}`\n },\n url(node) {\n return `z.url()${lengthConstraints(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n ref(node) {\n if (!node.name) return null\n const refName = node.ref ? (extractRefName(node.ref) ?? node.name) : node.name\n\n // In the input direction, a date-bearing component resolves to its `${name}InputSchema`\n // variant so request bodies encode `Date → string` instead of decoding.\n const useInputVariant = node.ref != null && this.options.direction === 'input' && containsCodec(node)\n const resolvedName = node.ref\n ? useInputVariant\n ? (this.options.resolver?.resolveInputSchemaName(refName) ?? refName)\n : (this.options.resolver?.default(refName, 'function') ?? refName)\n : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const entries = node.properties.map((prop) => {\n const { name: propName, schema } = prop\n\n const meta = ast.syncSchemaRef(schema)\n\n const isNullable = meta.nullable\n const isOptional = schema.optional\n const isNullish = schema.nullish\n\n const hasSelfRef = this.options.cyclicSchemas != null && ast.containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n // Inside a getter the getter itself defers evaluation, so suppress\n // z.lazy() wrapping on nested refs by temporarily clearing cyclicSchemas.\n // Save before clearing: this.options === options (same reference via definePrinter),\n // so reading options.cyclicSchemas after mutation would return undefined.\n const savedCyclicSchemas = this.options.cyclicSchemas\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = savedCyclicSchemas\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n // When a property schema is not a ref but the metadata is from a ref (e.g., discriminator\n // property override), skip applying the description from the ref target to avoid applying\n // metadata from a replaced schema.\n const descriptionToApply = schema.type !== 'ref' && meta.type === 'ref' ? undefined : meta.description\n\n const value = applyModifiers({\n value: wrappedOutput,\n nullable: isNullable,\n optional: isOptional,\n nullish: isNullish,\n defaultValue: meta.default,\n description: descriptionToApply,\n })\n\n if (hasSelfRef) {\n return `get ${objectKey(propName)}() { return ${value} }`\n }\n return `${objectKey(propName)}: ${value}`\n })\n\n const objectBase = `z.object(${buildObject(entries)})`\n\n // Handle additionalProperties as .catchall() or .strict()\n const result = (() => {\n if (node.additionalProperties && node.additionalProperties !== true) {\n const catchallType = this.transform(node.additionalProperties)\n return catchallType ? `${objectBase}.catchall(${catchallType})` : objectBase\n }\n if (node.additionalProperties === true) return `${objectBase}.catchall(${this.transform(ast.createSchema({ type: 'unknown' }))})`\n if (node.additionalProperties === false) return `${objectBase}.strict()`\n return objectBase\n })()\n\n return result\n },\n array(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.createSchema({ type: 'unknown' }))!\n const base = `z.array(${inner})${lengthConstraints(node)}`\n\n return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : base\n },\n tuple(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n\n return `z.tuple(${buildList(items)})`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = nodeMembers\n .map((memberNode) => {\n const member = this.transform(memberNode)\n\n return member && node.strategy === 'one' ? strictOneOfMember(member, memberNode) : member\n })\n .filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, ${buildList(members)})`\n }\n\n return `z.union(${buildList(members)})`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n const firstBase = this.transform(first)\n if (!firstBase) return ''\n\n return rest.reduce((acc, member) => {\n const constraint = getMemberConstraint(member)\n if (constraint) return acc + constraint\n const transformed = this.transform(member)\n return transformed ? `${acc}.and(${transformed})` : acc\n }, firstBase)\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const meta = ast.syncSchemaRef(node)\n\n const base = (() => {\n if (!keysToOmit?.length || meta.primitive !== 'object' || (meta.type === 'union' && meta.discriminatorPropertyName)) return transformed\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = transformed.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n return `${transformed}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n })()\n\n return applyModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n description: meta.description,\n })\n },\n }\n})\n","import { buildList, buildObject, extractRefName, objectKey, stringify } from '@kubb/ast/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyMiniModifiers, formatLiteral, lengthChecksMini, numberChecksMini } from '../utils.ts'\n\n/**\n * Partial map of node-type overrides for the Zod Mini printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * mini: true,\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.iso.date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodMiniNodes = ast.PrinterPartial<string, PrinterZodMiniOptions>\n\nexport type PrinterZodMiniOptions = {\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodMiniNodes\n}\n\n/**\n * Factory options for the Zod Mini printer, defining input/output types and configuration.\n */\nexport type PrinterZodMiniFactory = ast.PrinterFactoryOptions<'zod-mini', PrinterZodMiniOptions, string, string>\n\nfunction strictOneOfMember(member: string, node: ast.SchemaNode): string {\n if (node.type === 'object' && (node.additionalProperties === undefined || node.additionalProperties === false)) {\n return member.replace(/^z\\.object\\(/, 'z.strictObject(')\n }\n\n return member\n}\n\nfunction getMemberConstraintMini(member: ast.SchemaNode): string | undefined {\n if (member.primitive === 'string') return lengthChecksMini(ast.narrowSchema(member, 'string') ?? {}) || undefined\n if (member.primitive === 'number' || member.primitive === 'integer')\n return numberChecksMini(ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer') ?? {}) || undefined\n if (member.primitive === 'array') return lengthChecksMini(ast.narrowSchema(member, 'array') ?? {}) || undefined\n}\n\n/**\n * Zod v4 **Mini** printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the functional API\n * (`z.optional(z.string())`) for improved tree-shaking. See {@link printerZod} for the chainable API.\n *\n * @example Functional Mini API\n * ```ts\n * const printer = printerZodMini({})\n * const code = printer.print(optionalStringNode) // \"z.optional(z.string())\"\n * ```\n */\nexport const printerZodMini = ast.definePrinter<PrinterZodMiniFactory>((options) => {\n return {\n name: 'zod-mini',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n return `z.string()${lengthChecksMini(node)}`\n },\n number(node) {\n return `z.number()${numberChecksMini(node)}`\n },\n integer(node) {\n return `z.int()${numberChecksMini(node)}`\n },\n bigint(node) {\n return `z.bigint()${numberChecksMini(node)}`\n },\n date(node) {\n if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return 'z.date()'\n },\n datetime() {\n // Mini mode: datetime validation via z.string() (z.iso.datetime not available in mini)\n return 'z.string()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthChecksMini(node)}`\n },\n email(node) {\n return `z.email()${lengthChecksMini(node)}`\n },\n url(node) {\n return `z.url()${lengthChecksMini(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n\n ref(node) {\n if (!node.name) return null\n const refName = node.ref ? (extractRefName(node.ref) ?? node.name) : node.name\n const resolvedName = node.ref ? (this.options.resolver?.default(refName, 'function') ?? refName) : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const entries = node.properties.map((prop) => {\n const { name: propName, schema } = prop\n\n const meta = ast.syncSchemaRef(schema)\n\n const isNullable = meta.nullable\n const isOptional = schema.optional\n const isNullish = schema.nullish\n\n const hasSelfRef = this.options.cyclicSchemas != null && ast.containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n // Inside a getter the getter itself defers evaluation, so suppress\n // z.lazy() wrapping on nested refs by temporarily clearing cyclicSchemas.\n // Save before clearing: this.options === options (same reference via definePrinter),\n // so reading options.cyclicSchemas after mutation would return undefined.\n const savedCyclicSchemas = this.options.cyclicSchemas\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = savedCyclicSchemas\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n const value = applyMiniModifiers({\n value: wrappedOutput,\n nullable: isNullable,\n optional: isOptional,\n nullish: isNullish,\n defaultValue: meta.default,\n })\n\n if (hasSelfRef) {\n return `get ${objectKey(propName)}() { return ${value} }`\n }\n return `${objectKey(propName)}: ${value}`\n })\n\n return `z.object(${buildObject(entries)})`\n },\n array(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.createSchema({ type: 'unknown' }))!\n const base = `z.array(${inner})${lengthChecksMini(node)}`\n\n return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : base\n },\n tuple(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n\n return `z.tuple(${buildList(items)})`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = nodeMembers\n .map((memberNode) => {\n const member = this.transform(memberNode)\n\n return member && node.strategy === 'one' ? strictOneOfMember(member, memberNode) : member\n })\n .filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, ${buildList(members)})`\n }\n\n return `z.union(${buildList(members)})`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n const firstBase = this.transform(first)\n if (!firstBase) return ''\n\n return rest.reduce((acc, member) => {\n const constraint = getMemberConstraintMini(member)\n if (constraint) return acc + constraint\n const transformed = this.transform(member)\n return transformed ? `z.intersection(${acc}, ${transformed})` : acc\n }, firstBase)\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const meta = ast.syncSchemaRef(node)\n\n const base = (() => {\n if (!keysToOmit?.length || meta.primitive !== 'object' || (meta.type === 'union' && meta.discriminatorPropertyName)) return transformed\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = transformed.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n return `${transformed}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n })()\n\n return applyMiniModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n })\n },\n }\n})\n","import { resolveContentTypeVariants } from '@internals/shared'\nimport { extractRefName } from '@kubb/ast/utils'\nimport type { Adapter } from '@kubb/core'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Operations } from '../components/Operations.tsx'\nimport { Zod } from '../components/Zod.tsx'\nimport { ZOD_NAMESPACE_IMPORTS } from '../constants.ts'\nimport { printerZod } from '../printers/printerZod.ts'\nimport { printerZodMini } from '../printers/printerZodMini.ts'\nimport type { PluginZod, ResolverZod } from '../types'\nimport { buildSchemaNames, containsCodec } from '../utils.ts'\n\ntype StdPrinters = { output: ReturnType<typeof printerZod>; input: ReturnType<typeof printerZod> }\ntype ZodPrinterEntry = StdPrinters & { coercion: unknown; guidType: unknown; dateType: unknown }\ntype ZodMiniPrinterEntry = { printer: ReturnType<typeof printerZodMini>; guidType: unknown }\n\n// Per-build caches: keyed on resolver (unique per plugin instance per build, GC'd when released)\nconst zodPrinterCache = new WeakMap<ResolverZod, ZodPrinterEntry>()\nconst zodMiniPrinterCache = new WeakMap<ResolverZod, ZodMiniPrinterEntry>()\n\ntype StdPrinterParams = { coercion: unknown; guidType: unknown; dateType: unknown; wrapOutput: unknown; cyclicSchemas: ReadonlySet<string>; nodes: unknown }\n\n/**\n * Returns the cached `output`/`input` direction printers for a resolver, building them on\n * first use. The `input` printer encodes `Date → string` for request bodies; `output` decodes\n * `string → Date` for responses. Schemas without `dateType: 'date'` fields print identically.\n */\nfunction getStdPrinters(resolver: ResolverZod, params: StdPrinterParams): StdPrinters {\n const cached = zodPrinterCache.get(resolver)\n if (cached && cached.coercion === params.coercion && cached.guidType === params.guidType && cached.dateType === params.dateType) {\n return { output: cached.output, input: cached.input }\n }\n const base = { ...params, resolver } as Parameters<typeof printerZod>[0]\n const output = printerZod({ ...base, direction: 'output' })\n const input = printerZod({ ...base, direction: 'input' })\n zodPrinterCache.set(resolver, { output, input, coercion: params.coercion, guidType: params.guidType, dateType: params.dateType })\n return { output, input }\n}\n\nfunction getMiniPrinter(resolver: ResolverZod, params: { guidType: unknown; wrapOutput: unknown; cyclicSchemas: ReadonlySet<string>; nodes: unknown }) {\n const cached = zodMiniPrinterCache.get(resolver)\n if (cached && cached.guidType === params.guidType) return cached.printer\n const p = printerZodMini({ ...params, resolver } as Parameters<typeof printerZodMini>[0])\n zodMiniPrinterCache.set(resolver, { printer: p, guidType: params.guidType })\n return p\n}\n\n/**\n * Built-in generator for `@kubb/plugin-zod`. Emits one Zod schema per\n * schema in the spec plus per-operation request/response/parameter schemas.\n * When `mini: true`, schemas use the Zod Mini functional API instead of\n * chainable methods.\n */\nexport const zodGenerator = defineGenerator<PluginZod>({\n name: 'zod',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n if (!node.name) {\n return\n }\n\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n // A codec component is rendered twice: the canonical (output) schema decodes\n // `string → Date`, and an `${name}InputSchema` variant encodes `Date → string` for requests.\n const hasCodec = !mini && containsCodec(node)\n\n const codecRefNames = new Set(\n hasCodec\n ? ast.collect<string>(node, {\n schema: (n) => (n.type === 'ref' && n.ref && containsCodec(n) ? (extractRefName(n.ref) ?? undefined) : undefined),\n })\n : [],\n )\n const importEntries = adapter.getImports(node, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n const inputImportEntries = hasCodec\n ? [...codecRefNames].map((schemaName) => ({\n name: [resolver.resolveInputSchemaName(schemaName)],\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n : []\n const seenImports = new Set<string>()\n const imports = [...importEntries, ...inputImportEntries].filter((imp) => {\n const key = `${Array.isArray(imp.name) ? imp.name.join(',') : imp.name}|${imp.path}`\n if (seenImports.has(key)) return false\n seenImports.add(key)\n return true\n })\n\n const meta = {\n name: resolver.resolveSchemaName(node.name),\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group: group ?? undefined }),\n } as const\n\n const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : null\n\n const stdPrinters = mini ? null : getStdPrinters(resolver, { coercion, guidType, dateType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })\n const schemaPrinter = mini ? getMiniPrinter(resolver, { guidType, wrapOutput, cyclicSchemas, nodes: printer?.nodes }) : stdPrinters!.output\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Zod name={meta.name} node={node} printer={schemaPrinter} inferTypeName={inferTypeName} />\n {hasCodec && stdPrinters && (\n <Zod\n name={resolver.resolveInputSchemaName(node.name)}\n node={node}\n printer={stdPrinters.input}\n inferTypeName={inferred ? resolver.resolveInputSchemaTypeName(node.name) : null}\n />\n )}\n </File>\n )\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const params = ast.caseParams(node.parameters, paramsCasing)\n\n const meta = {\n file: resolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output, group: group ?? undefined },\n ),\n } as const\n\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n function renderSchemaEntry({\n schema,\n name,\n keysToOmit,\n direction = 'output',\n }: {\n schema: ast.SchemaNode | null\n name: string\n keysToOmit?: Array<string> | null\n direction?: 'input' | 'output'\n }) {\n if (!schema) return null\n\n const inferTypeName = inferred ? resolver.resolveTypeName(name) : null\n\n // In the input direction, refs to codec components resolve to their input variant.\n const codecRefNames =\n direction === 'input' && !mini\n ? new Set(\n ast.collect<string>(schema, {\n schema: (n) => (n.type === 'ref' && n.ref && containsCodec(n) ? (extractRefName(n.ref) ?? undefined) : undefined),\n }),\n )\n : null\n const imports = adapter.getImports(schema, (schemaName) => ({\n name: codecRefNames?.has(schemaName) ? resolver.resolveInputSchemaName(schemaName) : resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n\n const schemaPrinter = mini\n ? keysToOmit?.length\n ? printerZodMini({ guidType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : getMiniPrinter(resolver, { guidType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })\n : keysToOmit?.length\n ? printerZod({ coercion, guidType, dateType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes, direction })\n : getStdPrinters(resolver, { coercion, guidType, dateType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })[direction]\n\n return (\n <>\n {imports.map((imp) => (\n <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n <Zod name={name} node={schema} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </>\n )\n }\n\n // Multiple content types for a single name — emit one schema per content type plus a union alias.\n function buildContentTypeVariants(\n entries: Array<{ contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }>,\n baseName: string,\n decorate?: (schema: ast.SchemaNode) => ast.SchemaNode,\n direction?: 'input' | 'output',\n ) {\n const variants = resolveContentTypeVariants(entries, baseName)\n const unionSchema = ast.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.createSchema({ type: 'ref', name: variant.name })),\n })\n return (\n <>\n {variants.map((variant) =>\n renderSchemaEntry({\n schema: decorate ? decorate(variant.schema) : variant.schema,\n name: variant.name,\n keysToOmit: variant.keysToOmit,\n direction,\n }),\n )}\n {renderSchemaEntry({ schema: unionSchema, name: baseName, direction })}\n </>\n )\n }\n\n const paramSchemas = params.map((param) => renderSchemaEntry({ schema: param.schema, name: resolver.resolveParamName(node, param), direction: 'input' }))\n\n const responseSchemas = node.responses.map((res) => {\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length > 1) {\n return buildContentTypeVariants(res.content!, resolver.resolveResponseStatusName(node, res.statusCode))\n }\n const primary = variants[0] ?? res.content?.[0]\n return renderSchemaEntry({\n schema: primary?.schema ?? null,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n keysToOmit: primary?.keysToOmit,\n })\n })\n\n const responsesWithSchema = node.responses.filter((res) => res.content?.some((entry) => entry.schema))\n const responseUnionSchema =\n responsesWithSchema.length > 0\n ? (() => {\n const responseUnionName = resolver.resolveResponseName(node)\n\n // Collect all import names from response schemas to detect naming collisions.\n // When a response is a $ref to a component schema whose resolved name matches\n // the response union name, skip generation to avoid redeclaration errors.\n const importedNames = new Set(\n responsesWithSchema.flatMap((res) =>\n (res.content ?? []).flatMap((entry) =>\n entry.schema\n ? adapter\n .getImports(entry.schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: '',\n }))\n .flatMap((imp) => (Array.isArray(imp.name) ? imp.name : [imp.name]))\n : [],\n ),\n ),\n )\n\n if (importedNames.has(responseUnionName)) {\n return null\n }\n\n const members = responsesWithSchema.map((res) => ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, res.statusCode) }))\n const unionNode = members.length === 1 ? members[0]! : ast.createSchema({ type: 'union', members })\n\n return renderSchemaEntry({\n schema: unionNode,\n name: responseUnionName,\n })\n })()\n : null\n\n const requestBodyContent = node.requestBody?.content ?? []\n const requestSchema = (() => {\n if (requestBodyContent.length === 0) return null\n if (requestBodyContent.length === 1) {\n const entry = requestBodyContent[0]!\n if (!entry.schema) return null\n return renderSchemaEntry({\n schema: { ...entry.schema, description: node.requestBody!.description ?? entry.schema.description },\n name: resolver.resolveDataName(node),\n keysToOmit: entry.keysToOmit,\n direction: 'input',\n })\n }\n return buildContentTypeVariants(\n requestBodyContent,\n resolver.resolveDataName(node),\n (schema) => ({\n ...schema,\n description: node.requestBody!.description ?? schema.description,\n }),\n 'input',\n )\n })()\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {paramSchemas}\n {responseSchemas}\n {responseUnionSchema}\n {requestSchema}\n </File>\n )\n },\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, importPath, group, operations, paramsCasing } = ctx.options\n\n if (!operations) {\n return\n }\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const meta = {\n file: resolver.resolveFile({ name: 'operations', extname: '.ts' }, { root, output, group: group ?? undefined }),\n } as const\n\n const transformedOperations = nodes.filter(ast.isHttpOperationNode).map((node) => {\n const params = ast.caseParams(node.parameters, paramsCasing)\n\n return {\n node,\n data: buildSchemaNames(node, { params, resolver }),\n }\n })\n\n const imports = transformedOperations.flatMap(({ node, data }) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean) as Array<string>\n const opFile = resolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output, group: group ?? undefined },\n )\n\n return names.map((name) => <File.Import key={[name, opFile.path].join('-')} name={[name]} root={meta.file.path} path={opFile.path} />)\n })\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import isTypeOnly name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {imports}\n <Operations name=\"operations\" operations={transformedOperations} />\n </File>\n )\n },\n})\n","import { camelCase, ensureValidVarName, pascalCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginZod } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-zod`. Decides the names and file\n * paths for every generated Zod schema. Schemas use camelCase with a\n * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase\n * with a `SchemaType` suffix (`PetSchemaType`), so the value and the type\n * never share an identifier even when the schema name is all-uppercase.\n *\n * @example Resolve schema and type names\n * ```ts\n * import { resolverZod } from '@kubb/plugin-zod'\n *\n * resolverZod.default('list pets', 'function') // 'listPetsSchema'\n * resolverZod.resolveSchemaTypeName('pet') // 'PetSchemaType'\n * ```\n */\nexport const resolverZod = defineResolver<PluginZod>(() => {\n return {\n name: 'default',\n pluginName: 'plugin-zod',\n default(name, type) {\n if (type === 'file') return toFilePath(name, (part) => camelCase(part, { suffix: 'schema' }))\n return ensureValidVarName(camelCase(name, { suffix: type ? 'schema' : undefined }))\n },\n resolveSchemaName(name) {\n return ensureValidVarName(camelCase(name, { suffix: 'schema' }))\n },\n resolveSchemaTypeName(name) {\n return ensureValidVarName(pascalCase(name, { suffix: 'schema type' }))\n },\n resolveInputSchemaName(name) {\n return this.resolveSchemaName(`${name} input`)\n },\n resolveInputSchemaTypeName(name) {\n return this.resolveSchemaTypeName(`${name} input`)\n },\n resolveTypeName(name) {\n return ensureValidVarName(pascalCase(name, { suffix: 'type' }))\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveSchemaName(`${node.operationId} ${param.in} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveSchemaName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveSchemaName(`${node.operationId} Data`)\n },\n resolveResponsesName(node) {\n return this.resolveSchemaName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveSchemaName(`${node.operationId} Response`)\n },\n resolvePathParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveQueryParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveHeaderParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n }\n})\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { zodGenerator } from './generators/zodGenerator.tsx'\nimport { resolverZod } from './resolvers/resolverZod.ts'\nimport type { PluginZod } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-zod`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\n/**\n * Generates Zod v4 schemas from an OpenAPI spec. Use them to validate API\n * responses at runtime, build form schemas, or feed back into router libraries\n * that consume Zod (tRPC, Hono, Elysia). Pair with `@kubb/plugin-client` and\n * set the client's `parser: 'zod'` to validate every response automatically.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginZod } from '@kubb/plugin-zod'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginZod({\n * output: { path: './zod' },\n * typed: true,\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginZod = definePlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n typed = false,\n operations = false,\n mini = false,\n guidType = 'uuid',\n importPath = mini ? 'zod/mini' : 'zod',\n coercion = false,\n inferred = false,\n wrapOutput = undefined,\n paramsCasing,\n printer,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginZodName,\n options,\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n typed,\n importPath,\n coercion,\n operations,\n inferred,\n guidType,\n mini,\n wrapOutput,\n paramsCasing,\n printer,\n })\n ctx.setResolver(userResolver ? { ...resolverZod, ...userResolver } : resolverZod)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(zodGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n },\n },\n }\n})\n\nexport default pluginZod\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK,MAAM,CAAC;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,OAAO,KAAK,iBAAiB,MAAM,KAAK;EAC1C;EACA,wBAAwB,MAAM,OAAO;GACnC,OAAO,KAAK,iBAAiB,MAAM,KAAK;EAC1C;CACF;AACF,CAAC;;;;;;;AC5DD,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;AA2B7B,MAAa,aAAA,GAAA,WAAA,aAAA,EAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,QAAQ,EAAE,MAAM,QAAQ;CAAE,GAClD,OACA,UAAU,CAAC,GACX,SACA,WAAW,CAAC,GACZ,QAAQ,OACR,aAAa,OACb,OAAO,OACP,WAAW,QACX,aAAa,OAAO,aAAa,OACjC,WAAW,OACX,WAAW,OACX,aAAa,KAAA,GACb,cACA,SACA,UAAU,cACV,aAAa,iBACb,YAAY,iBAAiB,CAAC,MAC5B;CAEJ,MAAM,cAAc,kBAAkB,KAAK;CAE3C,OAAO;EACL,MAAM;EACN;EACA,OAAO,EACL,oBAAoB,KAAK;GACvB,IAAI,WAAW;IACb;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAAC;GACD,IAAI,YAAY,eAAe;IAAE,GAAG;IAAa,GAAG;GAAa,IAAI,WAAW;GAChF,IAAI,iBACF,IAAI,eAAe,eAAe;GAEpC,IAAI,aAAa,YAAY;GAC7B,KAAK,MAAM,OAAO,gBAChB,IAAI,aAAa,GAAG;EAExB,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["ast","File","Type","Const","File","Const","Type","ast","strictOneOfMember","ast","ast","jsxRenderer","File","ast"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../src/components/Operations.tsx","../src/components/Zod.tsx","../src/constants.ts","../src/utils.ts","../src/printers/printerZod.ts","../src/printers/printerZodMini.ts","../src/generators/zodGenerator.tsx","../src/resolvers/resolverZod.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n .filter(Boolean)\n .join('/')\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n","import { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from '@kubb/ast/utils'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.resolveFile`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n }\n\n return node.path ? `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}` : null\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type — a binary type\n * (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`, `video/*`) maps to `'blob'`\n * and other `text/*` maps to `'text'`. Otherwise `undefined`, leaving the runtime client's\n * `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n\n const baseType = contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nexport function getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isSuccessStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\n/**\n * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.\n * Each member is `{ status: N; data: StatusNType; statusText: string }`.\n */\nexport function buildStatusUnionType(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string {\n const members = node.responses.map((r) => {\n const typeName = resolver.resolveResponseStatusName(node, r.statusCode)\n const statusCode = Number.parseInt(r.statusCode, 10)\n const statusLiteral = Number.isNaN(statusCode) ? 'number' : String(statusCode)\n return `{ status: ${statusLiteral}; data: ${typeName}; statusText: string }`\n })\n if (members.length === 1) return members[0]!\n return `(${members.join(' | ')})`\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { stringifyObject } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype SchemaNames = {\n request: string | null\n parameters: {\n path: string | null\n query: string | null\n header: string | null\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype Props = {\n name: string\n operations: Array<{ node: ast.OperationNode; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbReactNode {\n const operationsJSON = operations.reduce<Record<string, unknown>>(\n (prev, acc) => {\n prev[`\"${acc.node.operationId}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce<Record<string, Record<string, string>>>((prev, acc) => {\n if (!ast.isHttpOperationNode(acc.node)) return prev\n prev[`\"${acc.node.path}\"`] = {\n ...(prev[`\"${acc.node.path}\"`] ?? {}),\n [acc.node.method]: `operations[\"${acc.node.operationId}\"]`,\n }\n\n return prev\n }, {})\n\n return (\n <>\n <File.Source name=\"OperationSchema\" isExportable isIndexable>\n <Type name=\"OperationSchema\" export>{`{\n readonly request: z.ZodTypeAny | undefined;\n readonly parameters: {\n readonly path: z.ZodTypeAny | undefined;\n readonly query: z.ZodTypeAny | undefined;\n readonly header: z.ZodTypeAny | undefined;\n };\n readonly responses: {\n readonly [status: number]: z.ZodTypeAny;\n readonly default: z.ZodTypeAny;\n };\n readonly errors: {\n readonly [status: number]: z.ZodTypeAny;\n };\n}`}</Type>\n </File.Source>\n <File.Source name=\"OperationsMap\" isExportable isIndexable>\n <Type name=\"OperationsMap\" export>\n {'Record<string, OperationSchema>'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} asConst>\n {`{${stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PrinterZodFactory } from '../printers/printerZod.ts'\nimport type { PrinterZodMiniFactory } from '../printers/printerZodMini.ts'\n\ntype Props = {\n name: string\n node: ast.SchemaNode\n /**\n * Pre-configured printer instance created by the generator.\n * The generator selects `printerZod` or `printerZodMini` based on the `mini` option,\n * then merges in any user-supplied `printer.nodes` overrides.\n */\n printer: ast.Printer<PrinterZodFactory> | ast.Printer<PrinterZodMiniFactory>\n inferTypeName?: string | null\n}\n\nexport function Zod({ name, node, printer, inferTypeName }: Props): KubbReactNode {\n const output = printer.print(node)\n\n if (!output) {\n return\n }\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name}>\n {output}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n </File.Source>\n )}\n </>\n )\n}\n","/**\n * Import paths that use a namespace import (`import * as z from '...'`).\n * All other import paths use a named import (`import { z } from '...'`).\n */\nexport const ZOD_NAMESPACE_IMPORTS = new Set(['zod', 'zod/mini'] as const)\n","import { extractRefName, stringify, toRegExpString } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport { syncSchemaRef } from '@kubb/ast/utils'\nimport type { PluginZod, ResolverZod } from './types.ts'\n\n/**\n * Returns `true` when the given coercion option enables coercion for the specified type.\n */\nexport function shouldCoerce(coercion: PluginZod['resolvedOptions']['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean {\n if (coercion === undefined || coercion === false) return false\n if (coercion === true) return true\n\n return !!coercion[type]\n}\n\n/**\n * A codec for a schema node whose runtime type differs from its JSON wire type:\n * the output (response) schema decodes wire → runtime, and the input (request)\n * variant encodes runtime → wire.\n *\n * To support another codec type, append a `Codec` to `codecs` and route that\n * type's printer node handler through `getCodec`.\n */\nexport type Codec = {\n /**\n * Whether this node is encoded/decoded by this codec.\n */\n matches(node: ast.SchemaNode): boolean\n /**\n * Output direction (response): decode the wire value into the runtime type.\n */\n decode(node: ast.SchemaNode): string\n /**\n * Input direction (request): encode the runtime value back to the wire value.\n */\n encode(node: ast.SchemaNode): string\n}\n\n/**\n * `dateType: 'date'` fields are typed as `Date` but travel as ISO `string`s.\n * Output decodes `string → Date`; input encodes `Date → string`, preserving the\n * `date` (`YYYY-MM-DD`) vs `date-time` precision carried on `node.format`.\n */\nconst dateCodec: Codec = {\n matches(node) {\n return node.type === 'date' && node.representation === 'date'\n },\n decode(node) {\n return node.format === 'date' ? 'z.iso.date().transform((value) => new Date(value))' : 'z.iso.datetime().transform((value) => new Date(value))'\n },\n encode(node) {\n return node.format === 'date' ? 'z.date().transform((value) => value.toISOString().slice(0, 10))' : 'z.date().transform((value) => value.toISOString())'\n },\n}\n\n/**\n * Registered codecs, checked in order.\n */\nconst codecs: Array<Codec> = [dateCodec]\n\n/**\n * Returns the codec for this node, or `undefined` when the node needs no\n * encode/decode (its wire and runtime types match).\n */\nexport function getCodec(node: ast.SchemaNode | undefined): Codec | undefined {\n if (!node) return undefined\n return codecs.find((codec) => codec.matches(node))\n}\n\n/**\n * Returns `true` when the node itself is encoded/decoded by a codec.\n */\nexport function hasCodec(node: ast.SchemaNode | undefined): boolean {\n return getCodec(node) !== undefined\n}\n\n/**\n * Returns `true` when the schema transitively contains a codec node —\n * a value whose runtime type differs from its wire type (see {@link hasCodec}),\n * so it must be decoded (response) or encoded (request) at the validation boundary.\n * `$ref`s are followed via their resolved schema; a `seen` set guards cycles.\n */\nexport function containsCodec(node: ast.SchemaNode | undefined, seen: Set<string> = new Set()): boolean {\n if (!node) return false\n\n if (hasCodec(node)) return true\n\n if (node.type === 'ref') {\n if (!node.ref) return false\n const refName = extractRefName(node.ref)\n if (refName) {\n if (seen.has(refName)) return false\n seen.add(refName)\n }\n const resolved = syncSchemaRef(node)\n if (resolved.type === 'ref') return false\n return containsCodec(resolved, seen)\n }\n\n const children: Array<ast.SchemaNode | undefined> = []\n if ('properties' in node && node.properties) children.push(...node.properties.map((prop) => prop.schema))\n if ('items' in node && node.items) children.push(...node.items)\n if ('members' in node && node.members) children.push(...node.members)\n if ('additionalProperties' in node && node.additionalProperties && node.additionalProperties !== true) children.push(node.additionalProperties)\n\n return children.some((child) => containsCodec(child, seen))\n}\n\n/**\n * Collects the names of `$ref` schemas that transitively contain a codec, so the generator can route\n * them to their input (encode) variant.\n */\nexport function collectCodecRefNames(node: ast.SchemaNode): Array<string> {\n return ast.collect<string>(node, {\n schema: (n) => (n.type === 'ref' && n.ref && containsCodec(n) ? (extractRefName(n.ref) ?? undefined) : undefined),\n })\n}\n\n/**\n * Collects all resolved schema names for an operation's parameters and responses\n * into a single lookup object, useful for building imports and type references.\n */\nexport function buildSchemaNames(node: ast.OperationNode, { params, resolver }: { params: Array<ast.ParameterNode>; resolver: ResolverZod }) {\n const pathParam = params.find((p) => p.in === 'path')\n const queryParam = params.find((p) => p.in === 'query')\n const headerParam = params.find((p) => p.in === 'header')\n\n const responses: Record<number | string, string> = {}\n const errors: Record<number | string, string> = {}\n\n for (const res of node.responses) {\n const name = resolver.resolveResponseStatusName(node, res.statusCode)\n const statusNum = Number(res.statusCode)\n\n if (!Number.isNaN(statusNum)) {\n responses[statusNum] = name\n if (statusNum >= 400) {\n errors[statusNum] = name\n }\n }\n }\n\n responses['default'] = resolver.resolveResponseName(node)\n\n return {\n request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null,\n parameters: {\n path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : null,\n query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : null,\n header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : null,\n },\n responses,\n errors,\n }\n}\n\n/**\n * Format a default value as a code-level literal.\n * Objects become `{}`, primitives become their string representation, strings are quoted.\n */\nexport function formatDefault(value: unknown): string {\n if (typeof value === 'string') return stringify(value)\n if (typeof value === 'object' && value !== null) return '{}'\n\n return String(value ?? '')\n}\n\n/**\n * Format a primitive enum/literal value.\n * Strings are quoted; numbers and booleans are emitted raw.\n */\nexport function formatLiteral(v: string | number | boolean): string {\n if (typeof v === 'string') return stringify(v)\n\n return String(v)\n}\n\n/**\n * Numeric constraint limits for Zod schemas (min, max, and exclusive bounds).\n */\nexport type NumericConstraints = {\n min?: number\n max?: number\n exclusiveMinimum?: number\n exclusiveMaximum?: number\n multipleOf?: number\n}\n\n/**\n * Length constraint limits for string and array schemas (min, max, and regex pattern).\n */\nexport type LengthConstraints = {\n min?: number\n max?: number\n pattern?: string\n}\n\n/**\n * Modifier options for applying chainable methods to Zod schema values.\n */\nexport type ModifierOptions = {\n value: string\n nullable?: boolean\n optional?: boolean\n nullish?: boolean\n defaultValue?: unknown\n description?: string\n}\n\n/**\n * Build `.min()` / `.max()` / `.gt()` / `.lt()` constraint chains for numbers\n * using the standard chainable Zod v4 API.\n */\nexport function numberConstraints({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : '',\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : '',\n multipleOf !== undefined ? `.multipleOf(${multipleOf})` : '',\n ].join('')\n}\n\n/**\n * Build `.min()` / `.max()` / `.regex()` chains for strings/arrays\n * using the standard chainable Zod v4 API.\n */\nexport function lengthConstraints({ min, max, pattern }: LengthConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n pattern !== undefined ? `.regex(${toRegExpString(pattern, null)})` : '',\n ].join('')\n}\n\n/**\n * Build `.check(z.minimum(), z.maximum())` for `zod/mini` numeric constraints.\n */\nexport function numberChecksMini({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n const checks: Array<string> = []\n if (min !== undefined) checks.push(`z.minimum(${min})`)\n if (max !== undefined) checks.push(`z.maximum(${max})`)\n if (exclusiveMinimum !== undefined) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`)\n if (exclusiveMaximum !== undefined) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`)\n if (multipleOf !== undefined) checks.push(`z.multipleOf(${multipleOf})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Build `.check(z.minLength(), z.maxLength(), z.regex())` for `zod/mini` length constraints.\n */\nexport function lengthChecksMini({ min, max, pattern }: LengthConstraints): string {\n const checks: Array<string> = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n if (pattern !== undefined) checks.push(`z.regex(${toRegExpString(pattern, null)})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Apply nullable / optional / nullish modifiers and an optional `.describe()` call\n * to a schema value string using the chainable Zod v4 API.\n */\nexport function applyModifiers({ value, nullable, optional, nullish, defaultValue, description }: ModifierOptions): string {\n const withModifier = (() => {\n if (nullish || (nullable && optional)) return `${value}.nullish()`\n if (optional) return `${value}.optional()`\n if (nullable) return `${value}.nullable()`\n return value\n })()\n const withDefault = defaultValue !== undefined ? `${withModifier}.default(${formatDefault(defaultValue)})` : withModifier\n return description ? `${withDefault}.describe(${stringify(description)})` : withDefault\n}\n\n/**\n * Apply nullable / optional / nullish modifiers using the functional `zod/mini` API\n * (`z.nullable()`, `z.optional()`, `z.nullish()`).\n */\nexport function applyMiniModifiers({ value, nullable, optional, nullish, defaultValue }: Omit<ModifierOptions, 'description'>): string {\n const withModifier = (() => {\n if (nullish) return `z.nullish(${value})`\n const withNullable = nullable ? `z.nullable(${value})` : value\n return optional ? `z.optional(${withNullable})` : withNullable\n })()\n return defaultValue !== undefined ? `z._default(${withModifier}, ${formatDefault(defaultValue)})` : withModifier\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ast.ParameterNode>\n optional?: boolean\n}\n\n/**\n * Builds an `object` schema node grouping the given parameter nodes.\n * The `primitive: 'object'` marker ensures the Zod printer emits `z.object(…)` rather than a record.\n */\nexport function buildGroupedParamsSchema({ params, optional }: BuildGroupedParamsSchemaOptions): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n optional,\n primitive: 'object',\n properties: params.map((param) =>\n ast.factory.createProperty({\n name: param.name,\n required: param.required,\n schema: param.schema,\n }),\n ),\n })\n}\n","import {\n buildList,\n buildObject,\n extractRefName,\n lazyGetter,\n mapSchemaItems,\n mapSchemaMembers,\n mapSchemaProperties,\n objectKey,\n stringify,\n} from '@kubb/ast/utils'\n\nimport { ast } from '@kubb/core'\nimport { containsCircularRef, syncSchemaRef } from '@kubb/ast/utils'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyModifiers, containsCodec, formatLiteral, getCodec, lengthConstraints, numberConstraints, shouldCoerce } from '../utils.ts'\nimport type { AdapterOas } from '@kubb/adapter-oas'\n\n/**\n * Partial map of node-type overrides for the Zod printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.string().date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodNodes = ast.PrinterPartial<string, PrinterZodOptions>\n\nexport type PrinterZodOptions = {\n /**\n * Enable automatic type coercion for strings, numbers, and dates.\n */\n coercion?: PluginZod['resolvedOptions']['coercion']\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Date format in the OpenAPI spec (`'date'` or `'date-time'`).\n */\n dateType?: AdapterOas['resolvedOptions']['dateType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Print direction for `dateType: 'date'` fields (`Date` in TypeScript):\n * - `'output'` (default) — decode the wire `string` into a `Date` (response bodies).\n * - `'input'` — encode a `Date` back into the wire `string` (request bodies/params).\n *\n * Diverging the directions requires the generator to emit an `${name}InputSchema`\n * variant for each date-bearing component.\n */\n direction?: 'input' | 'output'\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodNodes\n}\n\n/**\n * Factory options for the Zod printer, defining input/output types and configuration.\n */\nexport type PrinterZodFactory = ast.PrinterFactoryOptions<'zod', PrinterZodOptions, string, string>\n\nfunction strictOneOfMember(member: string, node: ast.SchemaNode): string {\n if (node.type === 'object' && node.additionalProperties === undefined) {\n return `${member}.strict()`\n }\n\n if (node.type === 'ref') {\n if (member.startsWith('z.lazy(')) {\n return member\n }\n\n const schema = syncSchemaRef(node)\n\n if (schema.type === 'object' && (schema.additionalProperties === undefined || schema.additionalProperties === false)) {\n return `${member}.strict()`\n }\n }\n\n return member\n}\n\nfunction getMemberConstraint(member: ast.SchemaNode): string | undefined {\n if (member.primitive === 'string') return lengthConstraints(ast.narrowSchema(member, 'string') ?? {}) || undefined\n if (member.primitive === 'number' || member.primitive === 'integer')\n return numberConstraints(ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer') ?? {}) || undefined\n if (member.primitive === 'array') return lengthConstraints(ast.narrowSchema(member, 'array') ?? {}) || undefined\n}\n\n/**\n * Zod v4 printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the chainable API\n * (`.optional()`, `.nullable()`, `.omit()`, etc.). For improved tree-shaking, see {@link printerZodMini}.\n *\n * @example Chainable API\n * ```ts\n * const printer = printerZod({ coercion: false })\n * const code = printer.print(stringNode) // \"z.string()\"\n * ```\n */\nexport const printerZod = ast.definePrinter<PrinterZodFactory>((options) => {\n return {\n name: 'zod',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n const base = shouldCoerce(this.options.coercion, 'strings') ? 'z.coerce.string()' : 'z.string()'\n\n return `${base}${lengthConstraints(node)}`\n },\n number(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number()' : 'z.number()'\n\n return `${base}${numberConstraints(node)}`\n },\n integer(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number().int()' : 'z.int()'\n\n return `${base}${numberConstraints(node)}`\n },\n bigint() {\n return shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.bigint()' : 'z.bigint()'\n },\n date(node) {\n // representation: 'date' → typed as `Date`; decode/encode at the boundary.\n const codec = getCodec(node)\n if (codec) {\n return this.options.direction === 'input' ? codec.encode(node) : codec.decode(node)\n }\n\n return 'z.iso.date()'\n },\n datetime(node) {\n const offset = node.offset || this.options.dateType === 'stringOffset'\n const local = node.local || this.options.dateType === 'stringLocal'\n\n if (offset) return 'z.iso.datetime({ offset: true })'\n if (local) return 'z.iso.datetime({ local: true })'\n\n return 'z.iso.datetime()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthConstraints(node)}`\n },\n email(node) {\n return `z.email()${lengthConstraints(node)}`\n },\n url(node) {\n return `z.url()${lengthConstraints(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n ref(node) {\n if (!node.name) return null\n const refName = node.ref ? (extractRefName(node.ref) ?? node.name) : node.name\n\n // In the input direction, a date-bearing component resolves to its `${name}InputSchema`\n // variant so request bodies encode `Date → string` instead of decoding.\n const useInputVariant = node.ref != null && this.options.direction === 'input' && containsCodec(node)\n const resolvedName = node.ref\n ? useInputVariant\n ? (this.options.resolver?.resolveInputSchemaName(refName) ?? refName)\n : (this.options.resolver?.default(refName, 'function') ?? refName)\n : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const isCyclic = (schema: ast.SchemaNode): boolean =>\n this.options.cyclicSchemas != null && containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n\n const entries = mapSchemaProperties(node, (schema) => {\n // Inside a getter the getter itself defers evaluation, so suppress z.lazy() wrapping on\n // nested refs by temporarily clearing cyclicSchemas. Save before clearing: this.options\n // === options (same reference via definePrinter), so reading it after mutation returns undefined.\n const hasSelfRef = isCyclic(schema)\n const savedCyclicSchemas = this.options.cyclicSchemas\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.factory.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = savedCyclicSchemas\n return baseOutput\n }).map(({ name: propName, property, output: baseOutput }) => {\n const { schema } = property\n const meta = syncSchemaRef(schema)\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n // When a property schema is not a ref but the metadata is from a ref (e.g., discriminator\n // property override), skip applying the description from the ref target to avoid applying\n // metadata from a replaced schema.\n const descriptionToApply = schema.type !== 'ref' && meta.type === 'ref' ? undefined : meta.description\n\n const value = applyModifiers({\n value: wrappedOutput,\n nullable: meta.nullable,\n optional: schema.optional || property.required === false,\n nullish: schema.nullish,\n defaultValue: meta.default,\n description: descriptionToApply,\n })\n\n return isCyclic(schema) ? lazyGetter({ name: propName, body: value }) : `${objectKey(propName)}: ${value}`\n })\n\n const objectBase = `z.object(${buildObject(entries)})`\n\n // Handle additionalProperties as .catchall() or .strict()\n const result = (() => {\n if (node.additionalProperties && node.additionalProperties !== true) {\n const catchallType = this.transform(node.additionalProperties)\n return catchallType ? `${objectBase}.catchall(${catchallType})` : objectBase\n }\n if (node.additionalProperties === true) return `${objectBase}.catchall(${this.transform(ast.factory.createSchema({ type: 'unknown' }))})`\n if (node.additionalProperties === false) return `${objectBase}.strict()`\n return objectBase\n })()\n\n return result\n },\n array(node) {\n const items = mapSchemaItems(node, (item) => this.transform(item))\n .map(({ output }) => output)\n .filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.factory.createSchema({ type: 'unknown' }))!\n const base = `z.array(${inner})${lengthConstraints(node)}`\n\n return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : base\n },\n tuple(node) {\n const items = mapSchemaItems(node, (item) => this.transform(item))\n .map(({ output }) => output)\n .filter(Boolean)\n\n return `z.tuple(${buildList(items)})`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = mapSchemaMembers(node, (memberNode) => this.transform(memberNode))\n .map(({ schema, output }) => (output && node.strategy === 'one' ? strictOneOfMember(output, schema) : output))\n .filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, ${buildList(members)})`\n }\n\n return `z.union(${buildList(members)})`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n const firstBase = this.transform(first)\n if (!firstBase) return ''\n\n return rest.reduce((acc, member) => {\n const constraint = getMemberConstraint(member)\n if (constraint) return acc + constraint\n const transformed = this.transform(member)\n return transformed ? `${acc}.and(${transformed})` : acc\n }, firstBase)\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const meta = syncSchemaRef(node)\n\n const base = (() => {\n if (!keysToOmit?.length || meta.primitive !== 'object' || (meta.type === 'union' && meta.discriminatorPropertyName)) return transformed\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = transformed.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n return `${transformed}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n })()\n\n return applyModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n description: meta.description,\n })\n },\n }\n})\n","import {\n buildList,\n buildObject,\n extractRefName,\n lazyGetter,\n mapSchemaItems,\n mapSchemaMembers,\n mapSchemaProperties,\n objectKey,\n stringify,\n} from '@kubb/ast/utils'\n\nimport { ast } from '@kubb/core'\nimport { containsCircularRef, syncSchemaRef } from '@kubb/ast/utils'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyMiniModifiers, formatLiteral, lengthChecksMini, numberChecksMini } from '../utils.ts'\n\n/**\n * Partial map of node-type overrides for the Zod Mini printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * mini: true,\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.iso.date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodMiniNodes = ast.PrinterPartial<string, PrinterZodMiniOptions>\n\nexport type PrinterZodMiniOptions = {\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodMiniNodes\n}\n\n/**\n * Factory options for the Zod Mini printer, defining input/output types and configuration.\n */\nexport type PrinterZodMiniFactory = ast.PrinterFactoryOptions<'zod-mini', PrinterZodMiniOptions, string, string>\n\nfunction strictOneOfMember(member: string, node: ast.SchemaNode): string {\n if (node.type === 'object' && (node.additionalProperties === undefined || node.additionalProperties === false)) {\n return member.replace(/^z\\.object\\(/, 'z.strictObject(')\n }\n\n return member\n}\n\nfunction getMemberConstraintMini(member: ast.SchemaNode): string | undefined {\n if (member.primitive === 'string') return lengthChecksMini(ast.narrowSchema(member, 'string') ?? {}) || undefined\n if (member.primitive === 'number' || member.primitive === 'integer')\n return numberChecksMini(ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer') ?? {}) || undefined\n if (member.primitive === 'array') return lengthChecksMini(ast.narrowSchema(member, 'array') ?? {}) || undefined\n}\n\n/**\n * Zod v4 **Mini** printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the functional API\n * (`z.optional(z.string())`) for improved tree-shaking. See {@link printerZod} for the chainable API.\n *\n * @example Functional Mini API\n * ```ts\n * const printer = printerZodMini({})\n * const code = printer.print(optionalStringNode) // \"z.optional(z.string())\"\n * ```\n */\nexport const printerZodMini = ast.definePrinter<PrinterZodMiniFactory>((options) => {\n return {\n name: 'zod-mini',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n return `z.string()${lengthChecksMini(node)}`\n },\n number(node) {\n return `z.number()${numberChecksMini(node)}`\n },\n integer(node) {\n return `z.int()${numberChecksMini(node)}`\n },\n bigint(node) {\n return `z.bigint()${numberChecksMini(node)}`\n },\n date(node) {\n if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return 'z.date()'\n },\n datetime() {\n // Mini mode: datetime validation via z.string() (z.iso.datetime not available in mini)\n return 'z.string()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthChecksMini(node)}`\n },\n email(node) {\n return `z.email()${lengthChecksMini(node)}`\n },\n url(node) {\n return `z.url()${lengthChecksMini(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n\n ref(node) {\n if (!node.name) return null\n const refName = node.ref ? (extractRefName(node.ref) ?? node.name) : node.name\n const resolvedName = node.ref ? (this.options.resolver?.default(refName, 'function') ?? refName) : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const isCyclic = (schema: ast.SchemaNode): boolean =>\n this.options.cyclicSchemas != null && containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n\n const entries = mapSchemaProperties(node, (schema) => {\n // Inside a getter the getter itself defers evaluation, so suppress z.lazy() wrapping on\n // nested refs by temporarily clearing cyclicSchemas. Save before clearing: this.options\n // === options (same reference via definePrinter), so reading it after mutation returns undefined.\n const hasSelfRef = isCyclic(schema)\n const savedCyclicSchemas = this.options.cyclicSchemas\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.factory.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = savedCyclicSchemas\n return baseOutput\n }).map(({ name: propName, property, output: baseOutput }) => {\n const { schema } = property\n const meta = syncSchemaRef(schema)\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n const value = applyMiniModifiers({\n value: wrappedOutput,\n nullable: meta.nullable,\n optional: schema.optional || property.required === false,\n nullish: schema.nullish,\n defaultValue: meta.default,\n })\n\n return isCyclic(schema) ? lazyGetter({ name: propName, body: value }) : `${objectKey(propName)}: ${value}`\n })\n\n return `z.object(${buildObject(entries)})`\n },\n array(node) {\n const items = mapSchemaItems(node, (item) => this.transform(item))\n .map(({ output }) => output)\n .filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.factory.createSchema({ type: 'unknown' }))!\n const base = `z.array(${inner})${lengthChecksMini(node)}`\n\n return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : base\n },\n tuple(node) {\n const items = mapSchemaItems(node, (item) => this.transform(item))\n .map(({ output }) => output)\n .filter(Boolean)\n\n return `z.tuple(${buildList(items)})`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = mapSchemaMembers(node, (memberNode) => this.transform(memberNode))\n .map(({ schema, output }) => (output && node.strategy === 'one' ? strictOneOfMember(output, schema) : output))\n .filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, ${buildList(members)})`\n }\n\n return `z.union(${buildList(members)})`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n const firstBase = this.transform(first)\n if (!firstBase) return ''\n\n return rest.reduce((acc, member) => {\n const constraint = getMemberConstraintMini(member)\n if (constraint) return acc + constraint\n const transformed = this.transform(member)\n return transformed ? `z.intersection(${acc}, ${transformed})` : acc\n }, firstBase)\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const meta = syncSchemaRef(node)\n\n const base = (() => {\n if (!keysToOmit?.length || meta.primitive !== 'object' || (meta.type === 'union' && meta.discriminatorPropertyName)) return transformed\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = transformed.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n return `${transformed}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n })()\n\n return applyMiniModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n })\n },\n }\n})\n","import { resolveContentTypeVariants } from '@internals/shared'\nimport type { Adapter } from '@kubb/core'\nimport { caseParams } from '@kubb/ast/utils'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Operations } from '../components/Operations.tsx'\nimport { Zod } from '../components/Zod.tsx'\nimport { ZOD_NAMESPACE_IMPORTS } from '../constants.ts'\nimport { printerZod } from '../printers/printerZod.ts'\nimport { printerZodMini } from '../printers/printerZodMini.ts'\nimport type { PluginZod, ResolverZod } from '../types'\nimport { buildSchemaNames, collectCodecRefNames, containsCodec } from '../utils.ts'\n\ntype StdPrinters = { output: ReturnType<typeof printerZod>; input: ReturnType<typeof printerZod> }\ntype ZodPrinterEntry = StdPrinters & { coercion: unknown; guidType: unknown; dateType: unknown }\ntype ZodMiniPrinterEntry = { printer: ReturnType<typeof printerZodMini>; guidType: unknown }\n\n// Per-build caches: keyed on resolver (unique per plugin instance per build, GC'd when released)\nconst zodPrinterCache = new WeakMap<ResolverZod, ZodPrinterEntry>()\nconst zodMiniPrinterCache = new WeakMap<ResolverZod, ZodMiniPrinterEntry>()\n\ntype StdPrinterParams = { coercion: unknown; guidType: unknown; dateType: unknown; wrapOutput: unknown; cyclicSchemas: ReadonlySet<string>; nodes: unknown }\n\n/**\n * Returns the cached `output`/`input` direction printers for a resolver, building them on\n * first use. The `input` printer encodes `Date → string` for request bodies; `output` decodes\n * `string → Date` for responses. Schemas without `dateType: 'date'` fields print identically.\n */\nfunction getStdPrinters(resolver: ResolverZod, params: StdPrinterParams): StdPrinters {\n const cached = zodPrinterCache.get(resolver)\n if (cached && cached.coercion === params.coercion && cached.guidType === params.guidType && cached.dateType === params.dateType) {\n return { output: cached.output, input: cached.input }\n }\n const base = { ...params, resolver } as Parameters<typeof printerZod>[0]\n const output = printerZod({ ...base, direction: 'output' })\n const input = printerZod({ ...base, direction: 'input' })\n zodPrinterCache.set(resolver, { output, input, coercion: params.coercion, guidType: params.guidType, dateType: params.dateType })\n return { output, input }\n}\n\nfunction getMiniPrinter(resolver: ResolverZod, params: { guidType: unknown; wrapOutput: unknown; cyclicSchemas: ReadonlySet<string>; nodes: unknown }) {\n const cached = zodMiniPrinterCache.get(resolver)\n if (cached && cached.guidType === params.guidType) return cached.printer\n const p = printerZodMini({ ...params, resolver } as Parameters<typeof printerZodMini>[0])\n zodMiniPrinterCache.set(resolver, { printer: p, guidType: params.guidType })\n return p\n}\n\n/**\n * Built-in generator for `@kubb/plugin-zod`. Emits one Zod schema per\n * schema in the spec plus per-operation request/response/parameter schemas.\n * When `mini: true`, schemas use the Zod Mini functional API instead of\n * chainable methods.\n */\nexport const zodGenerator = defineGenerator<PluginZod>({\n name: 'zod',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n if (!node.name) {\n return\n }\n\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n // A codec component is rendered twice: the canonical (output) schema decodes\n // `string → Date`, and an `${name}InputSchema` variant encodes `Date → string` for requests.\n const hasCodec = !mini && containsCodec(node)\n\n const codecRefNames = new Set(hasCodec ? collectCodecRefNames(node) : [])\n const importEntries = adapter.getImports(node, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n const inputImportEntries = hasCodec\n ? [...codecRefNames].map((schemaName) => ({\n name: [resolver.resolveInputSchemaName(schemaName)],\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n : []\n const seenImports = new Set<string>()\n const imports = [...importEntries, ...inputImportEntries].filter((imp) => {\n const key = `${Array.isArray(imp.name) ? imp.name.join(',') : imp.name}|${imp.path}`\n if (seenImports.has(key)) return false\n seenImports.add(key)\n return true\n })\n\n const meta = {\n name: resolver.resolveSchemaName(node.name),\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group: group ?? undefined }),\n } as const\n\n const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : null\n\n const stdPrinters = mini ? null : getStdPrinters(resolver, { coercion, guidType, dateType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })\n const schemaPrinter = mini ? getMiniPrinter(resolver, { guidType, wrapOutput, cyclicSchemas, nodes: printer?.nodes }) : stdPrinters!.output\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Zod name={meta.name} node={node} printer={schemaPrinter} inferTypeName={inferTypeName} />\n {hasCodec && stdPrinters && (\n <Zod\n name={resolver.resolveInputSchemaName(node.name)}\n node={node}\n printer={stdPrinters.input}\n inferTypeName={inferred ? resolver.resolveInputSchemaTypeName(node.name) : null}\n />\n )}\n </File>\n )\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const params = caseParams(node.parameters, paramsCasing)\n\n const meta = {\n file: resolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output, group: group ?? undefined },\n ),\n } as const\n\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n function renderSchemaEntry({\n schema,\n name,\n keysToOmit,\n direction = 'output',\n }: {\n schema: ast.SchemaNode | null\n name: string\n keysToOmit?: Array<string> | null\n direction?: 'input' | 'output'\n }) {\n if (!schema) return null\n\n const inferTypeName = inferred ? resolver.resolveTypeName(name) : null\n\n // In the input direction, refs to codec components resolve to their input variant.\n const codecRefNames = direction === 'input' && !mini ? new Set(collectCodecRefNames(schema)) : null\n const imports = adapter.getImports(schema, (schemaName) => ({\n name: codecRefNames?.has(schemaName) ? resolver.resolveInputSchemaName(schemaName) : resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n\n const schemaPrinter = mini\n ? keysToOmit?.length\n ? printerZodMini({ guidType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : getMiniPrinter(resolver, { guidType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })\n : keysToOmit?.length\n ? printerZod({ coercion, guidType, dateType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes, direction })\n : getStdPrinters(resolver, { coercion, guidType, dateType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })[direction]\n\n return (\n <>\n {imports.map((imp) => (\n <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n <Zod name={name} node={schema} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </>\n )\n }\n\n // Multiple content types for a single name — emit one schema per content type plus a union alias.\n function buildContentTypeVariants(\n entries: Array<{ contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }>,\n baseName: string,\n decorate?: (schema: ast.SchemaNode) => ast.SchemaNode,\n direction?: 'input' | 'output',\n ) {\n const variants = resolveContentTypeVariants(entries, baseName)\n const unionSchema = ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name })),\n })\n return (\n <>\n {variants.map((variant) =>\n renderSchemaEntry({\n schema: decorate ? decorate(variant.schema) : variant.schema,\n name: variant.name,\n keysToOmit: variant.keysToOmit,\n direction,\n }),\n )}\n {renderSchemaEntry({ schema: unionSchema, name: baseName, direction })}\n </>\n )\n }\n\n const paramSchemas = params.map((param) => renderSchemaEntry({ schema: param.schema, name: resolver.resolveParamName(node, param), direction: 'input' }))\n\n const responseSchemas = node.responses.map((res) => {\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length > 1) {\n return buildContentTypeVariants(res.content!, resolver.resolveResponseStatusName(node, res.statusCode))\n }\n const primary = variants[0] ?? res.content?.[0]\n return renderSchemaEntry({\n schema: primary?.schema ?? null,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n keysToOmit: primary?.keysToOmit,\n })\n })\n\n const responsesWithSchema = node.responses.filter((res) => res.content?.some((entry) => entry.schema))\n const responseUnionSchema =\n responsesWithSchema.length > 0\n ? (() => {\n const responseUnionName = resolver.resolveResponseName(node)\n\n // Collect all import names from response schemas to detect naming collisions.\n // When a response is a $ref to a component schema whose resolved name matches\n // the response union name, skip generation to avoid redeclaration errors.\n const importedNames = new Set(\n responsesWithSchema.flatMap((res) =>\n (res.content ?? []).flatMap((entry) =>\n entry.schema\n ? adapter\n .getImports(entry.schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: '',\n }))\n .flatMap((imp) => (Array.isArray(imp.name) ? imp.name : [imp.name]))\n : [],\n ),\n ),\n )\n\n if (importedNames.has(responseUnionName)) {\n return null\n }\n\n const members = responsesWithSchema.map((res) =>\n ast.factory.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, res.statusCode) }),\n )\n const unionNode = members.length === 1 ? members[0]! : ast.factory.createSchema({ type: 'union', members })\n\n return renderSchemaEntry({\n schema: unionNode,\n name: responseUnionName,\n })\n })()\n : null\n\n const requestBodyContent = node.requestBody?.content ?? []\n const requestSchema = (() => {\n if (requestBodyContent.length === 0) return null\n if (requestBodyContent.length === 1) {\n const entry = requestBodyContent[0]!\n if (!entry.schema) return null\n return renderSchemaEntry({\n schema: { ...entry.schema, description: node.requestBody!.description ?? entry.schema.description },\n name: resolver.resolveDataName(node),\n keysToOmit: entry.keysToOmit,\n direction: 'input',\n })\n }\n return buildContentTypeVariants(\n requestBodyContent,\n resolver.resolveDataName(node),\n (schema) => ({\n ...schema,\n description: node.requestBody!.description ?? schema.description,\n }),\n 'input',\n )\n })()\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {paramSchemas}\n {responseSchemas}\n {responseUnionSchema}\n {requestSchema}\n </File>\n )\n },\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, importPath, group, operations, paramsCasing } = ctx.options\n\n if (!operations) {\n return\n }\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const meta = {\n file: resolver.resolveFile({ name: 'operations', extname: '.ts' }, { root, output, group: group ?? undefined }),\n } as const\n\n const transformedOperations = nodes.filter(ast.isHttpOperationNode).map((node) => {\n const params = caseParams(node.parameters, paramsCasing)\n\n return {\n node,\n data: buildSchemaNames(node, { params, resolver }),\n }\n })\n\n const imports = transformedOperations.flatMap(({ node, data }) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean) as Array<string>\n const opFile = resolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output, group: group ?? undefined },\n )\n\n return names.map((name) => <File.Import key={[name, opFile.path].join('-')} name={[name]} root={meta.file.path} path={opFile.path} />)\n })\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import isTypeOnly name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {imports}\n <Operations name=\"operations\" operations={transformedOperations} />\n </File>\n )\n },\n})\n","import { camelCase, ensureValidVarName, pascalCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginZod } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-zod`. Decides the names and file\n * paths for every generated Zod schema. Schemas use camelCase with a\n * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase\n * with a `SchemaType` suffix (`PetSchemaType`), so the value and the type\n * never share an identifier even when the schema name is all-uppercase.\n *\n * @example Resolve schema and type names\n * ```ts\n * import { resolverZod } from '@kubb/plugin-zod'\n *\n * resolverZod.default('list pets', 'function') // 'listPetsSchema'\n * resolverZod.resolveSchemaTypeName('pet') // 'PetSchemaType'\n * ```\n */\nexport const resolverZod = defineResolver<PluginZod>(() => {\n return {\n name: 'default',\n pluginName: 'plugin-zod',\n default(name, type) {\n if (type === 'file') return toFilePath(name, (part) => camelCase(part, { suffix: 'schema' }))\n return ensureValidVarName(camelCase(name, { suffix: type ? 'schema' : undefined }))\n },\n resolveSchemaName(name) {\n return ensureValidVarName(camelCase(name, { suffix: 'schema' }))\n },\n resolveSchemaTypeName(name) {\n return ensureValidVarName(pascalCase(name, { suffix: 'schema type' }))\n },\n resolveInputSchemaName(name) {\n return this.resolveSchemaName(`${name} input`)\n },\n resolveInputSchemaTypeName(name) {\n return this.resolveSchemaTypeName(`${name} input`)\n },\n resolveTypeName(name) {\n return ensureValidVarName(pascalCase(name, { suffix: 'type' }))\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveSchemaName(`${node.operationId} ${param.in} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveSchemaName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveSchemaName(`${node.operationId} Data`)\n },\n resolveResponsesName(node) {\n return this.resolveSchemaName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveSchemaName(`${node.operationId} Response`)\n },\n resolvePathParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveQueryParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveHeaderParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n }\n})\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { zodGenerator } from './generators/zodGenerator.tsx'\nimport { resolverZod } from './resolvers/resolverZod.ts'\nimport type { PluginZod } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-zod`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\n/**\n * Generates Zod v4 schemas from an OpenAPI spec. Use them to validate API\n * responses at runtime, build form schemas, or feed back into router libraries\n * that consume Zod (tRPC, Hono, Elysia). Pair with `@kubb/plugin-client` and\n * set the client's `parser: 'zod'` to validate every response automatically.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginZod } from '@kubb/plugin-zod'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginZod({\n * output: { path: './zod' },\n * typed: true,\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginZod = definePlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n typed = false,\n operations = false,\n mini = false,\n guidType = 'uuid',\n importPath = mini ? 'zod/mini' : 'zod',\n coercion = false,\n inferred = false,\n wrapOutput = undefined,\n paramsCasing,\n printer,\n resolver: userResolver,\n macros: userMacros,\n generators: userGenerators = [],\n } = options\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginZodName,\n options,\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n typed,\n importPath,\n coercion,\n operations,\n inferred,\n guidType,\n mini,\n wrapOutput,\n paramsCasing,\n printer,\n })\n ctx.setResolver(userResolver ? { ...resolverZod, ...userResolver } : resolverZod)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n ctx.addGenerator(zodGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n },\n },\n }\n})\n\nexport default pluginZod\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK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AChF,IAAI,YAAY,QACd,IAAI,UAAU,UAAU;GAE1B,IAAI,aAAa,YAAY;GAC7B,KAAK,MAAM,OAAO,gBAChB,IAAI,aAAa,GAAG;EAExB,EACF;CACF;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -347,9 +347,9 @@ type Options = OutputOptions & {
347
347
  nodes?: PrinterZodNodes | PrinterZodMiniNodes;
348
348
  };
349
349
  /**
350
- * AST visitor applied to each schema or operation node before printing.
350
+ * Macros applied to each schema or operation node before printing.
351
351
  */
352
- transformer?: ast.Visitor;
352
+ macros?: Array<ast.Macro>;
353
353
  };
354
354
  type ResolvedOptions = {
355
355
  output: Output;