@kubb/plugin-zod 5.0.0-beta.22 → 5.0.0-beta.25

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.
package/dist/index.cjs CHANGED
@@ -271,11 +271,11 @@ function buildSchemaNames(node, { params, resolver }) {
271
271
  }
272
272
  responses["default"] = resolver.resolveResponseName(node);
273
273
  return {
274
- request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0,
274
+ request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null,
275
275
  parameters: {
276
- path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : void 0,
277
- query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : void 0,
278
- header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : void 0
276
+ path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : null,
277
+ query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : null,
278
+ header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : null
279
279
  },
280
280
  responses,
281
281
  errors
@@ -727,6 +727,12 @@ const printerZodMini = _kubb_core.ast.definePrinter((options) => {
727
727
  //#region src/generators/zodGenerator.tsx
728
728
  const zodPrinterCache = /* @__PURE__ */ new WeakMap();
729
729
  const zodMiniPrinterCache = /* @__PURE__ */ new WeakMap();
730
+ /**
731
+ * Built-in generator for `@kubb/plugin-zod`. Emits one Zod schema per
732
+ * schema in the spec plus per-operation request/response/parameter schemas.
733
+ * When `mini: true`, schemas use the Zod Mini functional API instead of
734
+ * chainable methods.
735
+ */
730
736
  const zodGenerator = (0, _kubb_core.defineGenerator)({
731
737
  name: "zod",
732
738
  renderer: _kubb_renderer_jsx.jsxRendererSync,
@@ -745,7 +751,7 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
745
751
  }, {
746
752
  root,
747
753
  output,
748
- group
754
+ group: group ?? void 0
749
755
  }).path
750
756
  }));
751
757
  const meta = {
@@ -756,10 +762,10 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
756
762
  }, {
757
763
  root,
758
764
  output,
759
- group
765
+ group: group ?? void 0
760
766
  })
761
767
  };
762
- const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : void 0;
768
+ const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : null;
763
769
  const cyclicSchemas = new Set(ctx.meta.circularNames);
764
770
  const schemaPrinter = mini ? getCachedMiniPrinter() : getCachedStdPrinter();
765
771
  function getCachedStdPrinter() {
@@ -845,12 +851,12 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
845
851
  }, {
846
852
  root,
847
853
  output,
848
- group
854
+ group: group ?? void 0
849
855
  }) };
850
856
  const cyclicSchemas = new Set(ctx.meta.circularNames);
851
857
  function renderSchemaEntry({ schema, name, keysToOmit }) {
852
858
  if (!schema) return null;
853
- const inferTypeName = inferred ? resolver.resolveTypeName(name) : void 0;
859
+ const inferTypeName = inferred ? resolver.resolveTypeName(name) : null;
854
860
  const imports = adapter.getImports(schema, (schemaName) => ({
855
861
  name: resolver.resolveSchemaName(schemaName),
856
862
  path: resolver.resolveFile({
@@ -859,7 +865,7 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
859
865
  }, {
860
866
  root,
861
867
  output,
862
- group
868
+ group: group ?? void 0
863
869
  }).path
864
870
  }));
865
871
  const cachedStd = zodPrinterCache.get(resolver);
@@ -982,7 +988,7 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
982
988
  }, {
983
989
  root,
984
990
  output,
985
- group
991
+ group: group ?? void 0
986
992
  }) };
987
993
  const transformedOperations = nodes.map((node) => {
988
994
  return {
@@ -1007,7 +1013,7 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
1007
1013
  }, {
1008
1014
  root,
1009
1015
  output,
1010
- group
1016
+ group: group ?? void 0
1011
1017
  });
1012
1018
  return names.map((name) => /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
1013
1019
  name: [name],
@@ -1046,12 +1052,17 @@ const zodGenerator = (0, _kubb_core.defineGenerator)({
1046
1052
  //#endregion
1047
1053
  //#region src/resolvers/resolverZod.ts
1048
1054
  /**
1049
- * Naming convention resolver for Zod plugin.
1055
+ * Default resolver used by `@kubb/plugin-zod`. Decides the names and file
1056
+ * paths for every generated Zod schema. Schemas use camelCase with a
1057
+ * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase.
1050
1058
  *
1051
- * Provides default naming helpers using camelCase with a `Schema` suffix for schemas.
1059
+ * @example Resolve schema and type names
1060
+ * ```ts
1061
+ * import { resolverZod } from '@kubb/plugin-zod'
1052
1062
  *
1053
- * @example
1054
- * `resolverZod.default('list pets', 'function') // 'listPetsSchema'`
1063
+ * resolverZod.default('list pets', 'function') // 'listPetsSchema'
1064
+ * resolverZod.resolveSchemaTypeName('pet') // 'PetSchema'
1065
+ * ```
1055
1066
  */
1056
1067
  const resolverZod = (0, _kubb_core.defineResolver)(() => {
1057
1068
  return {
@@ -1104,19 +1115,32 @@ const resolverZod = (0, _kubb_core.defineResolver)(() => {
1104
1115
  //#endregion
1105
1116
  //#region src/plugin.ts
1106
1117
  /**
1107
- * Canonical plugin name for `@kubb/plugin-zod`, used in driver lookups and warnings.
1118
+ * Canonical plugin name for `@kubb/plugin-zod`. Used for driver lookups and
1119
+ * cross-plugin dependency references.
1108
1120
  */
1109
1121
  const pluginZodName = "plugin-zod";
1110
1122
  /**
1111
- * Generates Zod validation schemas from an OpenAPI specification.
1112
- * Walks schemas and operations, delegates to generators, and writes barrel files
1113
- * based on the configured `barrelType`.
1123
+ * Generates Zod v4 schemas from an OpenAPI spec. Use them to validate API
1124
+ * responses at runtime, build form schemas, or feed back into router libraries
1125
+ * that consume Zod (tRPC, Hono, Elysia). Pair with `@kubb/plugin-client` and
1126
+ * set the client's `parser: 'zod'` to validate every response automatically.
1114
1127
  *
1115
- * @example Zod schema generator
1128
+ * @example
1116
1129
  * ```ts
1117
- * import pluginZod from '@kubb/plugin-zod'
1130
+ * import { defineConfig } from 'kubb'
1131
+ * import { pluginTs } from '@kubb/plugin-ts'
1132
+ * import { pluginZod } from '@kubb/plugin-zod'
1133
+ *
1118
1134
  * export default defineConfig({
1119
- * plugins: [pluginZod({ output: { path: 'zod' } })]
1135
+ * input: { path: './petStore.yaml' },
1136
+ * output: { path: './src/gen' },
1137
+ * plugins: [
1138
+ * pluginTs(),
1139
+ * pluginZod({
1140
+ * output: { path: './zod' },
1141
+ * typed: true,
1142
+ * }),
1143
+ * ],
1120
1144
  * })
1121
1145
  * ```
1122
1146
  */
@@ -1131,7 +1155,7 @@ const pluginZod = (0, _kubb_core.definePlugin)((options) => {
1131
1155
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
1132
1156
  return `${camelCase(ctx.group)}Controller`;
1133
1157
  }
1134
- } : void 0;
1158
+ } : null;
1135
1159
  return {
1136
1160
  name: pluginZodName,
1137
1161
  options,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["File","Type","Const","File","Const","Type","strictOneOfMember","ast","ast","jsxRendererSync","File","ast"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.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 * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\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 const normalized = 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\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): 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\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringifyObject } from '@internals/utils'\nimport type { 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 | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\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 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\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 { stringify, toRegExpString } from '@internals/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 * 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) : undefined,\n parameters: {\n path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : undefined,\n query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : undefined,\n header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : undefined,\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: 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: 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 { stringify } from '@internals/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyModifiers, formatLiteral, 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 * 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 if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.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 ? (ast.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 properties = node.properties\n .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 \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n const objectBase = `z.object({\\n ${properties}\\n })`\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([${items.join(', ')}])`\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)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\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 { stringify } from '@internals/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 ? (ast.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 properties = node.properties\n .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 \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n return `z.object({\\n ${properties}\\n })`\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([${items.join(', ')}])`\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)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\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 type { Adapter } from '@kubb/core'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { File, jsxRendererSync } 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 } from '../utils.ts'\n\ntype ZodPrinterEntry = { printer: ReturnType<typeof printerZod>; 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\nexport const zodGenerator = defineGenerator<PluginZod>({\n name: 'zod',\n renderer: jsxRendererSync,\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 mode = ctx.getMode(output)\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const imports = adapter.getImports(node, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n const meta = {\n name: resolver.resolveSchemaName(node.name),\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group }),\n } as const\n\n const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : undefined\n\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n const schemaPrinter = mini ? getCachedMiniPrinter() : getCachedStdPrinter()\n function getCachedStdPrinter() {\n const cached = zodPrinterCache.get(resolver)\n if (cached && cached.coercion === coercion && cached.guidType === guidType && cached.dateType === dateType) {\n return cached.printer\n }\n const p = printerZod({ coercion, guidType, dateType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n zodPrinterCache.set(resolver, { printer: p, coercion, guidType, dateType })\n return p\n }\n function getCachedMiniPrinter() {\n const cached = zodMiniPrinterCache.get(resolver)\n if (cached && cached.guidType === guidType) {\n return cached.printer\n }\n const p = printerZodMini({ guidType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n zodMiniPrinterCache.set(resolver, { printer: p, guidType })\n return p\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 })}\n footer={resolver.resolveFooter(ctx.meta, { output, config })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {mode === 'split' && imports.map((imp) => <File.Import key={[node.name, imp.path].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n\n <Zod name={meta.name} node={node} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </File>\n )\n },\n operation(node, ctx) {\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 mode = ctx.getMode(output)\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({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n } as const\n\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n function renderSchemaEntry({ schema, name, keysToOmit }: { schema: ast.SchemaNode | null; name: string; keysToOmit?: Array<string> | null }) {\n if (!schema) return null\n\n const inferTypeName = inferred ? resolver.resolveTypeName(name) : undefined\n\n const imports = adapter.getImports(schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n const cachedStd = zodPrinterCache.get(resolver)\n const cachedMini = zodMiniPrinterCache.get(resolver)\n const schemaPrinter = mini\n ? keysToOmit?.length\n ? printerZodMini({ guidType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : cachedMini?.guidType === guidType\n ? cachedMini.printer\n : printerZodMini({ guidType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n : keysToOmit?.length\n ? printerZod({ coercion, guidType, dateType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : cachedStd?.coercion === coercion && cachedStd?.guidType === guidType && cachedStd?.dateType === dateType\n ? cachedStd.printer\n : printerZod({ coercion, guidType, dateType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n <Zod name={name} node={schema} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </>\n )\n }\n\n const paramSchemas = params.map((param) => renderSchemaEntry({ schema: param.schema, name: resolver.resolveParamName(node, param) }))\n\n const responseSchemas = node.responses.map((res) =>\n renderSchemaEntry({\n schema: res.schema,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n keysToOmit: res.keysToOmit,\n }),\n )\n\n const responsesWithSchema = node.responses.filter((res) => res.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.schema\n ? adapter\n .getImports(res.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 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 requestSchema = node.requestBody?.content?.[0]?.schema\n ? renderSchemaEntry({\n schema: {\n ...node.requestBody.content![0]!.schema!,\n description: node.requestBody.description ?? node.requestBody.content![0]!.schema!.description,\n },\n name: resolver.resolveDataName(node),\n keysToOmit: node.requestBody.content![0]!.keysToOmit,\n })\n : null\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 })}\n footer={resolver.resolveFooter(ctx.meta, { output, config })}\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 }),\n } as const\n\n const transformedOperations = nodes.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 string[]\n const opFile = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\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 })}\n footer={resolver.resolveFooter(ctx.meta, { output, config })}\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, pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginZod } from '../types.ts'\n\n/**\n * Naming convention resolver for Zod plugin.\n *\n * Provides default naming helpers using camelCase with a `Schema` suffix for schemas.\n *\n * @example\n * `resolverZod.default('list pets', 'function') // → 'listPetsSchema'`\n */\nexport const resolverZod = defineResolver<PluginZod>(() => {\n return {\n name: 'default',\n pluginName: 'plugin-zod',\n default(name, type) {\n return camelCase(name, { isFile: type === 'file', suffix: type ? 'schema' : undefined })\n },\n resolveSchemaName(name) {\n return camelCase(name, { suffix: 'schema' })\n },\n resolveSchemaTypeName(name) {\n return pascalCase(name, { suffix: 'schema' })\n },\n resolveTypeName(name) {\n return pascalCase(name)\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 { camelCase } from '@internals/utils'\nimport { definePlugin, type Group } 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 in driver lookups and warnings.\n */\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\n/**\n * Generates Zod validation schemas from an OpenAPI specification.\n * Walks schemas and operations, delegates to generators, and writes barrel files\n * based on the configured `barrelType`.\n *\n * @example Zod schema generator\n * ```ts\n * import pluginZod from '@kubb/plugin-zod'\n * export default defineConfig({\n * plugins: [pluginZod({ output: { path: 'zod' } })]\n * })\n * ```\n */\nexport const pluginZod = definePlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrelType: '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 = group\n ? ({\n ...group,\n name: (ctx) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n },\n } satisfies Group)\n : undefined\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":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAEH,CAAC,MAAM,gBAAgB,CAAC,OAAO,QAE3C,CACT,KAAK,MAAM,MAAM;EAEhB,IADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,EACjD,OAAO;EACrB,IAAI,MAAM,KAAK,CAAC,QAAQ,OA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,oBAAoB,KAAK;GACvB,IAAI,WAAW;IACb;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,CAAC;GACF,IAAI,YAAY,eAAe;IAAE,GAAG;IAAa,GAAG;IAAc,GAAG,YAAY;GACjF,IAAI,iBACF,IAAI,eAAe,gBAAgB;GAErC,IAAI,aAAa,aAAa;GAC9B,KAAK,MAAM,OAAO,gBAChB,IAAI,aAAa,IAAI;KAG1B;EACF;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["File","Type","Const","File","Const","Type","strictOneOfMember","ast","ast","jsxRendererSync","File","ast"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.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 * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\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 const normalized = 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\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): 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\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringifyObject } from '@internals/utils'\nimport type { 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 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 { stringify, toRegExpString } from '@internals/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 * 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 { stringify } from '@internals/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyModifiers, formatLiteral, 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 * 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 if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.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 ? (ast.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 properties = node.properties\n .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 \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n const objectBase = `z.object({\\n ${properties}\\n })`\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([${items.join(', ')}])`\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)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\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 { stringify } from '@internals/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 ? (ast.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 properties = node.properties\n .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 \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n return `z.object({\\n ${properties}\\n })`\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([${items.join(', ')}])`\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)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\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 type { Adapter } from '@kubb/core'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { File, jsxRendererSync } 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 } from '../utils.ts'\n\ntype ZodPrinterEntry = { printer: ReturnType<typeof printerZod>; 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\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: jsxRendererSync,\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 mode = ctx.getMode(output)\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const imports = 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\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 cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n const schemaPrinter = mini ? getCachedMiniPrinter() : getCachedStdPrinter()\n function getCachedStdPrinter() {\n const cached = zodPrinterCache.get(resolver)\n if (cached && cached.coercion === coercion && cached.guidType === guidType && cached.dateType === dateType) {\n return cached.printer\n }\n const p = printerZod({ coercion, guidType, dateType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n zodPrinterCache.set(resolver, { printer: p, coercion, guidType, dateType })\n return p\n }\n function getCachedMiniPrinter() {\n const cached = zodMiniPrinterCache.get(resolver)\n if (cached && cached.guidType === guidType) {\n return cached.printer\n }\n const p = printerZodMini({ guidType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n zodMiniPrinterCache.set(resolver, { printer: p, guidType })\n return p\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 })}\n footer={resolver.resolveFooter(ctx.meta, { output, config })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {mode === 'split' && imports.map((imp) => <File.Import key={[node.name, imp.path].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n\n <Zod name={meta.name} node={node} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </File>\n )\n },\n operation(node, ctx) {\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 mode = ctx.getMode(output)\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({ schema, name, keysToOmit }: { schema: ast.SchemaNode | null; name: string; keysToOmit?: Array<string> | null }) {\n if (!schema) return null\n\n const inferTypeName = inferred ? resolver.resolveTypeName(name) : null\n\n const imports = adapter.getImports(schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n\n const cachedStd = zodPrinterCache.get(resolver)\n const cachedMini = zodMiniPrinterCache.get(resolver)\n const schemaPrinter = mini\n ? keysToOmit?.length\n ? printerZodMini({ guidType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : cachedMini?.guidType === guidType\n ? cachedMini.printer\n : printerZodMini({ guidType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n : keysToOmit?.length\n ? printerZod({ coercion, guidType, dateType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : cachedStd?.coercion === coercion && cachedStd?.guidType === guidType && cachedStd?.dateType === dateType\n ? cachedStd.printer\n : printerZod({ coercion, guidType, dateType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n <Zod name={name} node={schema} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </>\n )\n }\n\n const paramSchemas = params.map((param) => renderSchemaEntry({ schema: param.schema, name: resolver.resolveParamName(node, param) }))\n\n const responseSchemas = node.responses.map((res) =>\n renderSchemaEntry({\n schema: res.schema,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n keysToOmit: res.keysToOmit,\n }),\n )\n\n const responsesWithSchema = node.responses.filter((res) => res.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.schema\n ? adapter\n .getImports(res.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 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 requestSchema = node.requestBody?.content?.[0]?.schema\n ? renderSchemaEntry({\n schema: {\n ...node.requestBody.content![0]!.schema!,\n description: node.requestBody.description ?? node.requestBody.content![0]!.schema!.description,\n },\n name: resolver.resolveDataName(node),\n keysToOmit: node.requestBody.content![0]!.keysToOmit,\n })\n : null\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 })}\n footer={resolver.resolveFooter(ctx.meta, { output, config })}\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.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 })}\n footer={resolver.resolveFooter(ctx.meta, { output, config })}\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, pascalCase } 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 *\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') // 'PetSchema'\n * ```\n */\nexport const resolverZod = defineResolver<PluginZod>(() => {\n return {\n name: 'default',\n pluginName: 'plugin-zod',\n default(name, type) {\n return camelCase(name, { isFile: type === 'file', suffix: type ? 'schema' : undefined })\n },\n resolveSchemaName(name) {\n return camelCase(name, { suffix: 'schema' })\n },\n resolveSchemaTypeName(name) {\n return pascalCase(name, { suffix: 'schema' })\n },\n resolveTypeName(name) {\n return pascalCase(name)\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 { camelCase } from '@internals/utils'\nimport { definePlugin, type Group } 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', barrelType: '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 = group\n ? ({\n ...group,\n name: (ctx) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n },\n } satisfies Group)\n : null\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":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KA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