@kubb/plugin-zod 4.19.2 → 4.20.1
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/{components-BgtqtaQt.js → components-BmXLaLL5.js} +4 -4
- package/dist/components-BmXLaLL5.js.map +1 -0
- package/dist/components-Cs1U51T4.cjs.map +1 -1
- package/dist/components.d.cts +4 -4
- package/dist/components.d.ts +4 -4
- package/dist/components.js +1 -1
- package/dist/{generators-C9G6FSvb.cjs → generators-BeILgXPF.cjs} +2 -2
- package/dist/generators-BeILgXPF.cjs.map +1 -0
- package/dist/{generators-D6WbQJ7U.js → generators-WdjCkovi.js} +4 -4
- package/dist/generators-WdjCkovi.js.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{types-CjzKMRjG.d.ts → types-BBLRijaO.d.ts} +5 -5
- package/dist/{types-Bg-j5IC5.d.cts → types-HQfz08mH.d.cts} +5 -5
- package/package.json +6 -6
- package/src/components/Operations.tsx +2 -2
- package/src/components/Zod.tsx +2 -2
- package/src/generators/zodGenerator.tsx +3 -3
- package/dist/components-BgtqtaQt.js.map +0 -1
- package/dist/generators-C9G6FSvb.cjs.map +0 -1
- package/dist/generators-D6WbQJ7U.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
|
2
2
|
import transformers from "@kubb/core/transformers";
|
|
3
3
|
import { SchemaGenerator, createParser, findSchemaKeyword, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
|
|
4
4
|
import { Const, File, Type } from "@kubb/react-fabric";
|
|
5
|
-
import { Fragment
|
|
5
|
+
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Operations.tsx
|
|
8
8
|
function Operations({ name, operations }) {
|
|
@@ -17,7 +17,7 @@ function Operations({ name, operations }) {
|
|
|
17
17
|
};
|
|
18
18
|
return prev;
|
|
19
19
|
}, {});
|
|
20
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
21
|
/* @__PURE__ */ jsx(File.Source, {
|
|
22
22
|
name: "OperationSchema",
|
|
23
23
|
isExportable: true,
|
|
@@ -709,7 +709,7 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
709
709
|
schema
|
|
710
710
|
}) || baseSchemaOutput : baseSchemaOutput;
|
|
711
711
|
const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ${version === "4" ? "z.ZodType" : "ToZod"}<${typeName}>` : wrappedSchemaOutput;
|
|
712
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
712
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
|
|
713
713
|
name,
|
|
714
714
|
isExportable: true,
|
|
715
715
|
isIndexable: true,
|
|
@@ -738,4 +738,4 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
738
738
|
|
|
739
739
|
//#endregion
|
|
740
740
|
export { Operations as n, Zod as t };
|
|
741
|
-
//# sourceMappingURL=components-
|
|
741
|
+
//# sourceMappingURL=components-BmXLaLL5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-BmXLaLL5.js","names":["schema","parserZod.sort","parserZod.filterMiniModifiers","parserZod.parse","parserZod.wrapWithMiniModifiers","parserZod.extractMiniModifiers"],"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): FabricReactNode {\n const operationsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.getOperationId()}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.path}\"`] = {\n ...(prev[`\"${acc.operation.path}\"`] || ({} as Record<HttpMethod, string>)),\n [acc.operation.method]: `operations[\"${acc.operation.getOperationId()}\"]`,\n }\n\n return prev\n },\n {} as Record<string, Record<HttpMethod, string>>,\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 {`{${transformers.stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${transformers.stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import transformers from '@kubb/core/transformers'\n\nimport type { Schema, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, SchemaGenerator, type SchemaKeywordMapper, schemaKeywords } from '@kubb/plugin-oas'\n\n//TODO add zodKeywordMapper as function that returns 3 versions: v3, v4 and v4 mini, this can also be used to have the custom mapping(see object type)\n// also include shouldCoerce\n\n/**\n * Helper to build string/array length constraint checks for Zod Mini mode\n */\nfunction buildLengthChecks(min?: number, max?: number): string[] {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n return checks\n}\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number, exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.number().check(${checks.join(', ')})`\n }\n return 'z.number()'\n }\n return [\n coercion ? 'z.coerce.number()' : 'z.number()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number, version: '3' | '4' = '3', exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.int().check(${checks.join(', ')})`\n }\n return 'z.int()'\n }\n return [\n coercion ? 'z.coerce.number().int()' : version === '4' ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n interface: (value?: string, strict?: boolean) => {\n if (strict) {\n return `z.strictInterface({\n ${value}\n })`\n }\n return `z.interface({\n ${value}\n })`\n },\n object: (value?: string, strict?: boolean, version: '3' | '4' = '3') => {\n if (version === '4' && strict) {\n return `z.strictObject({\n ${value}\n })`\n }\n\n if (strict) {\n return `z.object({\n ${value}\n }).strict()`\n }\n\n return `z.object({\n ${value}\n })`\n },\n string: (coercion?: boolean, min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.string().check(${checks.join(', ')})`\n }\n return 'z.string()'\n }\n return [coercion ? 'z.coerce.string()' : 'z.string()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n //support for discriminatedUnion\n boolean: () => 'z.boolean()',\n undefined: () => 'z.undefined()',\n nullable: (value?: string) => {\n if (value) {\n return `z.nullable(${value})`\n }\n return '.nullable()'\n },\n null: () => 'z.null()',\n nullish: (value?: string) => {\n if (value) {\n return `z.nullish(${value})`\n }\n return '.nullish()'\n },\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (unique) checks.push(`z.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`)\n if (checks.length > 0) {\n return `z.array(${items?.join('')}).check(${checks.join(', ')})`\n }\n return `z.array(${items?.join('')})`\n }\n return [\n `z.array(${items?.join('')})`,\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n unique ? `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n tuple: (items: string[] = []) => `z.tuple([${items?.join(', ')}])`,\n enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`,\n union: (items: string[] = []) => `z.union([${items?.join(', ')}])`,\n const: (value?: string | number | boolean) => `z.literal(${value ?? ''})`,\n /**\n * ISO 8601\n */\n datetime: (offset = false, local = false, version: '3' | '4' = '3', mini?: boolean) => {\n // Zod Mini doesn't support .datetime() method, use plain string\n if (mini) {\n return 'z.string()'\n }\n\n if (offset) {\n return version === '4' ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return version === '4' ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return version === '4' ? 'z.iso.datetime()' : 'z.string().datetime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.date()' : 'z.string().date()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.time()' : 'z.string().time()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n uuid: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.uuid().check(${checks.join(', ')})`\n }\n return 'z.uuid()'\n }\n return [\n coercion ? (version === '4' ? 'z.uuid()' : 'z.coerce.string().uuid()') : version === '4' ? 'z.uuid()' : 'z.string().uuid()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n url: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.url().check(${checks.join(', ')})`\n }\n return 'z.url()'\n }\n return [\n coercion ? (version === '4' ? 'z.url()' : 'z.coerce.string().url()') : version === '4' ? 'z.url()' : 'z.string().url()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n default: (value?: string | number | boolean | object, innerSchema?: string, mini?: boolean) => {\n if (mini && innerSchema) {\n const defaultValue = typeof value === 'object' ? '{}' : (value ?? '')\n return `z._default(${innerSchema}, ${defaultValue})`\n }\n\n if (typeof value === 'object') {\n return '.default({})'\n }\n\n if (value === undefined) {\n return '.default()'\n }\n\n if (typeof value === 'string' && !value) {\n return `.default('')`\n }\n\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = [], mini?: boolean) => {\n // zod/mini doesn't support .and() method, so we can't use intersection types\n // In mini mode, we try to extract and append .check() calls instead\n if (mini && items.length > 0) {\n // Try to extract check calls from additional items\n const checks: string[] = []\n for (const item of items) {\n // Extract .check(...) from patterns like \"z.string().check(...)\"\n // Need to handle nested parentheses properly\n const checkStart = item.indexOf('.check(')\n if (checkStart !== -1) {\n // Find the matching closing parenthesis\n let depth = 0\n let i = checkStart + 7 // length of '.check('\n let checkContent = ''\n while (i < item.length) {\n const char = item[i]\n if (char === '(') depth++\n else if (char === ')') {\n if (depth === 0) break\n depth--\n }\n checkContent += char\n i++\n }\n if (checkContent) {\n checks.push(checkContent)\n }\n }\n }\n\n if (checks.length > 0) {\n // Append checks to the base schema\n return `.check(${checks.join(', ')})`\n }\n\n // If we can't extract checks, just use the first schema (limitation)\n return ''\n }\n return items?.map((item) => `.and(${item})`).join('')\n },\n describe: (value = '', innerSchema?: string, mini?: boolean) => {\n if (mini) {\n return undefined\n }\n\n if (innerSchema) {\n return `z.describe(${innerSchema}, ${value})`\n }\n return `.describe(${value})`\n },\n max: undefined,\n min: undefined,\n optional: (value?: string) => {\n if (value) {\n return `z.optional(${value})`\n }\n return '.optional()'\n },\n matches: (value = '', coercion?: boolean, mini?: boolean, min?: number, max?: number) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n checks.push(`z.regex(${value})`)\n return `z.string().check(${checks.join(', ')})`\n }\n return [\n coercion ? 'z.coerce.string()' : 'z.string()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n `.regex(${value})`,\n ]\n .filter(Boolean)\n .join('')\n },\n email: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.email().check(${checks.join(', ')})`\n }\n return 'z.email()'\n }\n return [\n coercion ? (version === '4' ? 'z.email()' : 'z.coerce.string().email()') : version === '4' ? 'z.email()' : 'z.string().email()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (value?: string) => {\n if (!value) {\n return undefined\n }\n\n return `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string, mini?: boolean) => {\n // Zod Mini doesn't support .catchall() method\n if (mini) {\n return undefined\n }\n return value ? `.catchall(${value})` : undefined\n },\n name: undefined,\n exclusiveMinimum: undefined,\n exclusiveMaximum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nexport function sort(items?: Schema[]): Schema[] {\n const order: string[] = [\n schemaKeywords.string,\n schemaKeywords.datetime,\n schemaKeywords.date,\n schemaKeywords.time,\n schemaKeywords.tuple,\n schemaKeywords.number,\n schemaKeywords.object,\n schemaKeywords.enum,\n schemaKeywords.url,\n schemaKeywords.email,\n schemaKeywords.firstName,\n schemaKeywords.lastName,\n schemaKeywords.password,\n schemaKeywords.matches,\n schemaKeywords.uuid,\n schemaKeywords.null,\n schemaKeywords.min,\n schemaKeywords.max,\n schemaKeywords.default,\n schemaKeywords.describe,\n schemaKeywords.optional,\n schemaKeywords.nullable,\n schemaKeywords.nullish,\n ]\n\n if (!items) {\n return []\n }\n\n return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ['asc'])\n}\n\ntype MiniModifiers = {\n hasOptional?: boolean\n hasNullable?: boolean\n hasNullish?: boolean\n defaultValue?: string | number | true | object\n}\n\n/**\n * Keywords that represent modifiers for mini mode\n * These are separated from the base schema and wrapped around it\n * Note: describe is included to filter it out, but won't be wrapped (Zod Mini doesn't support describe)\n */\nexport const miniModifierKeywords = [schemaKeywords.optional, schemaKeywords.nullable, schemaKeywords.nullish, schemaKeywords.default, schemaKeywords.describe]\n\n/**\n * Extracts mini mode modifiers from a schemas array\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n * Note: describe is not included as Zod Mini doesn't support it\n */\nexport function extractMiniModifiers(schemas: Schema[]): MiniModifiers {\n const defaultSchema = schemas.find((item) => isKeyword(item, schemaKeywords.default)) as { keyword: string; args: unknown } | undefined\n\n return {\n hasOptional: schemas.some((item) => isKeyword(item, schemaKeywords.optional)),\n hasNullable: schemas.some((item) => isKeyword(item, schemaKeywords.nullable)),\n hasNullish: schemas.some((item) => isKeyword(item, schemaKeywords.nullish)),\n defaultValue: defaultSchema?.args as string | number | true | object | undefined,\n }\n}\n\n/**\n * Filters out modifier keywords from schemas for mini mode base schema parsing\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n */\nexport function filterMiniModifiers(schemas: Schema[]): Schema[] {\n return schemas.filter((item) => !miniModifierKeywords.some((keyword) => isKeyword(item, keyword)))\n}\n\n/**\n * Wraps an output string with Zod Mini functional modifiers\n * Order: default (innermost) -> nullable -> optional (outermost)\n * OR: default -> nullish\n * Note: describe is not supported in Zod Mini and is skipped\n */\nexport function wrapWithMiniModifiers(output: string, modifiers: MiniModifiers): string {\n let result = output\n\n // Apply default first (innermost wrapper)\n if (modifiers.defaultValue !== undefined) {\n result = zodKeywordMapper.default(modifiers.defaultValue, result, true)!\n }\n\n // Apply nullish, nullable, or optional (outer wrappers for optionality)\n if (modifiers.hasNullish) {\n result = zodKeywordMapper.nullish(result)!\n } else {\n if (modifiers.hasNullable) {\n result = zodKeywordMapper.nullable(result)!\n }\n if (modifiers.hasOptional) {\n result = zodKeywordMapper.optional(result)!\n }\n }\n\n return result\n}\n\nconst shouldCoerce = (coercion: ParserOptions['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean => {\n if (coercion === undefined) {\n return false\n }\n if (typeof coercion === 'boolean') {\n return coercion\n }\n\n return !!coercion[type]\n}\n\ntype ParserOptions = {\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n version: '3' | '4'\n skipLazyForRefs?: boolean\n mini?: boolean\n}\n\n// Create the parser using createParser\nexport const parse = createParser<string, ParserOptions>({\n mapper: zodKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, parent, name, siblings } = tree\n\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return this.parse({ schema, parent, name, current: current.args[0] as Schema, siblings }, options)\n }\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return zodKeywordMapper.union(\n sort(current.args)\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean),\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n const items = sort(current.args)\n .filter((schema: Schema) => {\n return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema.keyword as typeof schemaKeywords.describe)\n })\n .map((it: Schema, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n options.mini,\n )\n },\n enum(tree, options) {\n const { current, schema, name } = tree\n\n if (current.args.asConst) {\n if (current.args.items.length === 1) {\n const child = {\n keyword: schemaKeywords.const,\n args: current.args.items[0],\n }\n return this.parse({ schema, parent: current, name, current: child, siblings: [child] }, options)\n }\n\n return zodKeywordMapper.union(\n current.args.items\n .map((schema) => ({\n keyword: schemaKeywords.const,\n args: schema,\n }))\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n )\n }\n\n return zodKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'boolean') {\n return transformers.stringify(schema.value)\n }\n\n if (schema.format === 'number') {\n return transformers.stringify(schema.value)\n }\n return transformers.stringify(schema.value)\n }),\n )\n },\n ref(tree, options) {\n const { current } = tree\n\n // Skip z.lazy wrapper if skipLazyForRefs is true (e.g., inside v4 getters)\n if (options.skipLazyForRefs) {\n return current.args?.name\n }\n return zodKeywordMapper.ref(current.args?.name)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\n const propertyEntries = Object.entries(current.args?.properties || {}).filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n\n const properties = propertyEntries\n .map(([propertyName, schemas]) => {\n const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable))\n const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish))\n const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional))\n const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref)\n\n const mappedName = nameSchema?.args || propertyName\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${propertyName}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .filter((schema) => {\n return !isKeyword(schema, schemaKeywords.optional) && !isKeyword(schema, schemaKeywords.nullable) && !isKeyword(schema, schemaKeywords.nullish)\n })\n .map((it) => {\n // For v4 with refs, skip z.lazy wrapper since the getter provides lazy evaluation\n const skipLazyForRefs = options.version === '4' && hasRef\n return this.parse({ schema, parent: current, name, current: it, siblings: schemas }, { ...options, skipLazyForRefs })\n })\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: schema?.properties?.[propertyName] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (options.version === '4' && hasRef) {\n // In mini mode, use functional wrappers instead of chainable methods\n if (options.mini) {\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullish(objectValue)}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.optional(objectValue)}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullable(objectValue)}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // Non-mini mode uses chainable methods\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullish()}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.optional()}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullable()}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // both optional and nullable\n if (isNullish && options.mini) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullish(objectValue)}`\n }\n\n if (isNullish && !options.mini) {\n return `\"${propertyName}\": ${objectValue}${zodKeywordMapper.nullish()}`\n }\n\n // undefined\n if (isOptional) {\n return `\"${propertyName}\": ${zodKeywordMapper.optional(objectValue)}`\n }\n\n // null\n if (isNullable) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullable(objectValue)}`\n }\n\n return `\"${propertyName}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n zodKeywordMapper.object(properties, current.args?.strict, options.version),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.tuple(\n current.args.items.map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options)).filter(Boolean),\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number(current.args.value))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(typeof current.args.value === 'boolean' ? current.args.value : undefined)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n },\n matches(tree, options) {\n const { current, siblings } = tree\n\n // Early exit: if siblings contain both matches and ref → skip matches entirely\n const hasRef = siblings.some((it) => isKeyword(it, schemaKeywords.ref))\n if (hasRef) {\n return undefined // strip matches\n }\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n if (current.args) {\n return zodKeywordMapper.matches(\n transformers.toRegExpString(current.args, null),\n shouldCoerce(options.coercion, 'strings'),\n options.mini,\n minSchema?.args,\n maxSchema?.args,\n )\n }\n return undefined\n },\n default(tree, options) {\n const { current } = tree\n\n // In mini mode, default is handled by wrapWithMiniModifiers\n if (options.mini) {\n return undefined\n }\n if (current.args !== undefined) {\n return zodKeywordMapper.default(current.args)\n }\n // When args is undefined, call the mapper without arguments\n return zodKeywordMapper.default()\n },\n describe(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), undefined, options.mini)\n }\n return undefined\n },\n string(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'), minSchema?.args, maxSchema?.args, options.mini)\n },\n uuid(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n email(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n url(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n number(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.number(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n integer(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.integer(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n options.version,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n datetime(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini)\n },\n date(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n time(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n schema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n version: '3' | '4'\n emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType']\n mini?: boolean\n}\n\nexport function Zod({\n name,\n typeName,\n tree,\n schema,\n inferTypeName,\n mapper,\n coercion,\n keysToOmit,\n description,\n wrapOutput,\n version,\n emptySchemaType,\n mini = false,\n}: Props): FabricReactNode {\n const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple)\n\n const schemas = parserZod.sort(tree).filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n\n // In mini mode, filter out modifiers from the main schema parsing\n const baseSchemas = mini ? parserZod.filterMiniModifiers(schemas) : schemas\n\n const output = baseSchemas\n .map((schemaKeyword, index) => {\n const siblings = baseSchemas.filter((_, i) => i !== index)\n\n return parserZod.parse({ schema, parent: undefined, current: schemaKeyword, siblings, name }, { mapper, coercion, wrapOutput, version, mini })\n })\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n const firstSchema = schemas.at(0)\n const lastSchema = schemas.at(-1)\n\n if (!mini && lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap().unwrap()'\n }\n } else {\n suffix = '.unwrap()'\n }\n } else if (!mini) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.schema'\n } else {\n suffix = '.unwrap()'\n }\n }\n }\n\n const emptyValue = parserZod.parse(\n {\n schema,\n parent: undefined,\n current: {\n keyword: schemaKeywords[emptySchemaType],\n },\n siblings: [],\n },\n { mapper, coercion, wrapOutput, version, mini },\n )\n\n let baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n emptyValue ||\n ''\n\n // For mini mode, wrap the output with modifiers using the parser function\n if (mini) {\n baseSchemaOutput = parserZod.wrapWithMiniModifiers(baseSchemaOutput, parserZod.extractMiniModifiers(schemas))\n }\n\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ${version === '4' ? 'z.ZodType' : 'ToZod'}<${typeName}>` : wrappedSchemaOutput\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const\n export\n name={name}\n JSDoc={{\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }}\n >\n {finalOutput}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n {typeName && (\n <Type export name={inferTypeName}>\n {typeName}\n </Type>\n )}\n {!typeName && (\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n )}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;AAWA,SAAgB,WAAW,EAAE,MAAM,cAAsC;CACvE,MAAM,iBAAiB,WAAW,QAC/B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,gBAAgB,CAAC,MAAM,IAAI;AAElD,SAAO;IAET,EAAE,CACH;CAED,MAAM,YAAY,WAAW,QAC1B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,KAAK,MAAM;GAChC,GAAI,KAAK,IAAI,IAAI,UAAU,KAAK,OAAQ,EAAE;IACzC,IAAI,UAAU,SAAS,eAAe,IAAI,UAAU,gBAAgB,CAAC;GACvE;AAED,SAAO;IAET,EAAE,CACH;AAED,QACE;EACE,oBAAC,KAAK;GAAO,MAAK;GAAkB;GAAa;aAC/C,oBAAC;IAAK,MAAK;IAAkB;cAAQ;;;;;;;;;;;;;;;KAcnC;IACU;EACd,oBAAC,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KAET,UAAS;KAGX,UAAS;UAEF,CAAC,MACV;MAAI,eAAe,UAAU,aAAa,eAAe,IAAI,CAC3D,KAAI,YAAY,IACd,UAAS;MAET,UAAS;;CAKf,MAAM,aAAaA,MACjB;EACE;EACA,QAAQ;EACR,SAAS,EACP,SAAS,eAAe,kBACzB;EACD,UAAU,EAAE;EACb,EACD;EAAE;EAAQ;EAAU;EAAY;EAAS;EAAM,CAChD;CAED,IAAI,mBACF,CAAC,QAAQ,YAAY,SAAS,GAAG,OAAO,UAAU,WAAW,KAAK,QAAQ,IAAI,IAAI,SAAS,CAAC,KAAK,IAAI,CAAC,OAAO,OAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,GAAG,IAChJ,cACA;AAGF,KAAI,KACF,oBAAmBC,sBAAgC,kBAAkBC,qBAA+B,QAAQ,CAAC;CAG/G,MAAM,sBAAsB,aAAa,WAAW;EAAE,QAAQ;EAAkB;EAAQ,CAAC,IAAI,mBAAmB;CAChH,MAAM,cAAc,WAAW,GAAG,oBAAoB,iBAAiB,YAAY,MAAM,cAAc,QAAQ,GAAG,SAAS,KAAK;AAEhI,QACE,4CACE,oBAAC,KAAK;EAAa;EAAM;EAAa;YACpC,oBAAC;GACC;GACM;GACN,OAAO,EACL,UAAU,CAAC,cAAc,gBAAgB,aAAa,eAAe,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ,EACjH;aAEA;IACK;GACI,EACb,iBACC,qBAAC,KAAK;EAAO,MAAM;EAAe;EAAa;EAAY;aACxD,YACC,oBAAC;GAAK;GAAO,MAAM;aAChB;IACI,EAER,CAAC,YACA,oBAAC;GAAK;GAAO,MAAM;aAChB,kBAAkB,KAAK;IACnB;GAEG,IAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-Cs1U51T4.cjs","names":["File","Type","Const","transformers","schemaKeywords","transformers","schema","SchemaGenerator","SchemaGenerator","schemaKeywords","parserZod.sort","parserZod.filterMiniModifiers","parserZod.parse","parserZod.wrapWithMiniModifiers","parserZod.extractMiniModifiers","File","Const","transformers","Type"],"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbNode {\n const operationsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.getOperationId()}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.path}\"`] = {\n ...(prev[`\"${acc.operation.path}\"`] || ({} as Record<HttpMethod, string>)),\n [acc.operation.method]: `operations[\"${acc.operation.getOperationId()}\"]`,\n }\n\n return prev\n },\n {} as Record<string, Record<HttpMethod, string>>,\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 {`{${transformers.stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${transformers.stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import transformers from '@kubb/core/transformers'\n\nimport type { Schema, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, SchemaGenerator, type SchemaKeywordMapper, schemaKeywords } from '@kubb/plugin-oas'\n\n//TODO add zodKeywordMapper as function that returns 3 versions: v3, v4 and v4 mini, this can also be used to have the custom mapping(see object type)\n// also include shouldCoerce\n\n/**\n * Helper to build string/array length constraint checks for Zod Mini mode\n */\nfunction buildLengthChecks(min?: number, max?: number): string[] {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n return checks\n}\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number, exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.number().check(${checks.join(', ')})`\n }\n return 'z.number()'\n }\n return [\n coercion ? 'z.coerce.number()' : 'z.number()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number, version: '3' | '4' = '3', exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.int().check(${checks.join(', ')})`\n }\n return 'z.int()'\n }\n return [\n coercion ? 'z.coerce.number().int()' : version === '4' ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n interface: (value?: string, strict?: boolean) => {\n if (strict) {\n return `z.strictInterface({\n ${value}\n })`\n }\n return `z.interface({\n ${value}\n })`\n },\n object: (value?: string, strict?: boolean, version: '3' | '4' = '3') => {\n if (version === '4' && strict) {\n return `z.strictObject({\n ${value}\n })`\n }\n\n if (strict) {\n return `z.object({\n ${value}\n }).strict()`\n }\n\n return `z.object({\n ${value}\n })`\n },\n string: (coercion?: boolean, min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.string().check(${checks.join(', ')})`\n }\n return 'z.string()'\n }\n return [coercion ? 'z.coerce.string()' : 'z.string()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n //support for discriminatedUnion\n boolean: () => 'z.boolean()',\n undefined: () => 'z.undefined()',\n nullable: (value?: string) => {\n if (value) {\n return `z.nullable(${value})`\n }\n return '.nullable()'\n },\n null: () => 'z.null()',\n nullish: (value?: string) => {\n if (value) {\n return `z.nullish(${value})`\n }\n return '.nullish()'\n },\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (unique) checks.push(`z.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`)\n if (checks.length > 0) {\n return `z.array(${items?.join('')}).check(${checks.join(', ')})`\n }\n return `z.array(${items?.join('')})`\n }\n return [\n `z.array(${items?.join('')})`,\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n unique ? `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n tuple: (items: string[] = []) => `z.tuple([${items?.join(', ')}])`,\n enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`,\n union: (items: string[] = []) => `z.union([${items?.join(', ')}])`,\n const: (value?: string | number | boolean) => `z.literal(${value ?? ''})`,\n /**\n * ISO 8601\n */\n datetime: (offset = false, local = false, version: '3' | '4' = '3', mini?: boolean) => {\n // Zod Mini doesn't support .datetime() method, use plain string\n if (mini) {\n return 'z.string()'\n }\n\n if (offset) {\n return version === '4' ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return version === '4' ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return version === '4' ? 'z.iso.datetime()' : 'z.string().datetime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.date()' : 'z.string().date()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.time()' : 'z.string().time()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n uuid: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.uuid().check(${checks.join(', ')})`\n }\n return 'z.uuid()'\n }\n return [\n coercion ? (version === '4' ? 'z.uuid()' : 'z.coerce.string().uuid()') : version === '4' ? 'z.uuid()' : 'z.string().uuid()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n url: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.url().check(${checks.join(', ')})`\n }\n return 'z.url()'\n }\n return [\n coercion ? (version === '4' ? 'z.url()' : 'z.coerce.string().url()') : version === '4' ? 'z.url()' : 'z.string().url()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n default: (value?: string | number | boolean | object, innerSchema?: string, mini?: boolean) => {\n if (mini && innerSchema) {\n const defaultValue = typeof value === 'object' ? '{}' : (value ?? '')\n return `z._default(${innerSchema}, ${defaultValue})`\n }\n\n if (typeof value === 'object') {\n return '.default({})'\n }\n\n if (value === undefined) {\n return '.default()'\n }\n\n if (typeof value === 'string' && !value) {\n return `.default('')`\n }\n\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = [], mini?: boolean) => {\n // zod/mini doesn't support .and() method, so we can't use intersection types\n // In mini mode, we try to extract and append .check() calls instead\n if (mini && items.length > 0) {\n // Try to extract check calls from additional items\n const checks: string[] = []\n for (const item of items) {\n // Extract .check(...) from patterns like \"z.string().check(...)\"\n // Need to handle nested parentheses properly\n const checkStart = item.indexOf('.check(')\n if (checkStart !== -1) {\n // Find the matching closing parenthesis\n let depth = 0\n let i = checkStart + 7 // length of '.check('\n let checkContent = ''\n while (i < item.length) {\n const char = item[i]\n if (char === '(') depth++\n else if (char === ')') {\n if (depth === 0) break\n depth--\n }\n checkContent += char\n i++\n }\n if (checkContent) {\n checks.push(checkContent)\n }\n }\n }\n\n if (checks.length > 0) {\n // Append checks to the base schema\n return `.check(${checks.join(', ')})`\n }\n\n // If we can't extract checks, just use the first schema (limitation)\n return ''\n }\n return items?.map((item) => `.and(${item})`).join('')\n },\n describe: (value = '', innerSchema?: string, mini?: boolean) => {\n if (mini) {\n return undefined\n }\n\n if (innerSchema) {\n return `z.describe(${innerSchema}, ${value})`\n }\n return `.describe(${value})`\n },\n max: undefined,\n min: undefined,\n optional: (value?: string) => {\n if (value) {\n return `z.optional(${value})`\n }\n return '.optional()'\n },\n matches: (value = '', coercion?: boolean, mini?: boolean, min?: number, max?: number) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n checks.push(`z.regex(${value})`)\n return `z.string().check(${checks.join(', ')})`\n }\n return [\n coercion ? 'z.coerce.string()' : 'z.string()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n `.regex(${value})`,\n ]\n .filter(Boolean)\n .join('')\n },\n email: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.email().check(${checks.join(', ')})`\n }\n return 'z.email()'\n }\n return [\n coercion ? (version === '4' ? 'z.email()' : 'z.coerce.string().email()') : version === '4' ? 'z.email()' : 'z.string().email()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (value?: string) => {\n if (!value) {\n return undefined\n }\n\n return `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string, mini?: boolean) => {\n // Zod Mini doesn't support .catchall() method\n if (mini) {\n return undefined\n }\n return value ? `.catchall(${value})` : undefined\n },\n name: undefined,\n exclusiveMinimum: undefined,\n exclusiveMaximum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nexport function sort(items?: Schema[]): Schema[] {\n const order: string[] = [\n schemaKeywords.string,\n schemaKeywords.datetime,\n schemaKeywords.date,\n schemaKeywords.time,\n schemaKeywords.tuple,\n schemaKeywords.number,\n schemaKeywords.object,\n schemaKeywords.enum,\n schemaKeywords.url,\n schemaKeywords.email,\n schemaKeywords.firstName,\n schemaKeywords.lastName,\n schemaKeywords.password,\n schemaKeywords.matches,\n schemaKeywords.uuid,\n schemaKeywords.null,\n schemaKeywords.min,\n schemaKeywords.max,\n schemaKeywords.default,\n schemaKeywords.describe,\n schemaKeywords.optional,\n schemaKeywords.nullable,\n schemaKeywords.nullish,\n ]\n\n if (!items) {\n return []\n }\n\n return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ['asc'])\n}\n\ntype MiniModifiers = {\n hasOptional?: boolean\n hasNullable?: boolean\n hasNullish?: boolean\n defaultValue?: string | number | true | object\n}\n\n/**\n * Keywords that represent modifiers for mini mode\n * These are separated from the base schema and wrapped around it\n * Note: describe is included to filter it out, but won't be wrapped (Zod Mini doesn't support describe)\n */\nexport const miniModifierKeywords = [schemaKeywords.optional, schemaKeywords.nullable, schemaKeywords.nullish, schemaKeywords.default, schemaKeywords.describe]\n\n/**\n * Extracts mini mode modifiers from a schemas array\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n * Note: describe is not included as Zod Mini doesn't support it\n */\nexport function extractMiniModifiers(schemas: Schema[]): MiniModifiers {\n const defaultSchema = schemas.find((item) => isKeyword(item, schemaKeywords.default)) as { keyword: string; args: unknown } | undefined\n\n return {\n hasOptional: schemas.some((item) => isKeyword(item, schemaKeywords.optional)),\n hasNullable: schemas.some((item) => isKeyword(item, schemaKeywords.nullable)),\n hasNullish: schemas.some((item) => isKeyword(item, schemaKeywords.nullish)),\n defaultValue: defaultSchema?.args as string | number | true | object | undefined,\n }\n}\n\n/**\n * Filters out modifier keywords from schemas for mini mode base schema parsing\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n */\nexport function filterMiniModifiers(schemas: Schema[]): Schema[] {\n return schemas.filter((item) => !miniModifierKeywords.some((keyword) => isKeyword(item, keyword)))\n}\n\n/**\n * Wraps an output string with Zod Mini functional modifiers\n * Order: default (innermost) -> nullable -> optional (outermost)\n * OR: default -> nullish\n * Note: describe is not supported in Zod Mini and is skipped\n */\nexport function wrapWithMiniModifiers(output: string, modifiers: MiniModifiers): string {\n let result = output\n\n // Apply default first (innermost wrapper)\n if (modifiers.defaultValue !== undefined) {\n result = zodKeywordMapper.default(modifiers.defaultValue, result, true)!\n }\n\n // Apply nullish, nullable, or optional (outer wrappers for optionality)\n if (modifiers.hasNullish) {\n result = zodKeywordMapper.nullish(result)!\n } else {\n if (modifiers.hasNullable) {\n result = zodKeywordMapper.nullable(result)!\n }\n if (modifiers.hasOptional) {\n result = zodKeywordMapper.optional(result)!\n }\n }\n\n return result\n}\n\nconst shouldCoerce = (coercion: ParserOptions['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean => {\n if (coercion === undefined) {\n return false\n }\n if (typeof coercion === 'boolean') {\n return coercion\n }\n\n return !!coercion[type]\n}\n\ntype ParserOptions = {\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n version: '3' | '4'\n skipLazyForRefs?: boolean\n mini?: boolean\n}\n\n// Create the parser using createParser\nexport const parse = createParser<string, ParserOptions>({\n mapper: zodKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, parent, name, siblings } = tree\n\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return this.parse({ schema, parent, name, current: current.args[0] as Schema, siblings }, options)\n }\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return zodKeywordMapper.union(\n sort(current.args)\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean),\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n const items = sort(current.args)\n .filter((schema: Schema) => {\n return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema.keyword as typeof schemaKeywords.describe)\n })\n .map((it: Schema, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n options.mini,\n )\n },\n enum(tree, options) {\n const { current, schema, name } = tree\n\n if (current.args.asConst) {\n if (current.args.items.length === 1) {\n const child = {\n keyword: schemaKeywords.const,\n args: current.args.items[0],\n }\n return this.parse({ schema, parent: current, name, current: child, siblings: [child] }, options)\n }\n\n return zodKeywordMapper.union(\n current.args.items\n .map((schema) => ({\n keyword: schemaKeywords.const,\n args: schema,\n }))\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n )\n }\n\n return zodKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'boolean') {\n return transformers.stringify(schema.value)\n }\n\n if (schema.format === 'number') {\n return transformers.stringify(schema.value)\n }\n return transformers.stringify(schema.value)\n }),\n )\n },\n ref(tree, options) {\n const { current } = tree\n\n // Skip z.lazy wrapper if skipLazyForRefs is true (e.g., inside v4 getters)\n if (options.skipLazyForRefs) {\n return current.args?.name\n }\n return zodKeywordMapper.ref(current.args?.name)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\n const propertyEntries = Object.entries(current.args?.properties || {}).filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n\n const properties = propertyEntries\n .map(([propertyName, schemas]) => {\n const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable))\n const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish))\n const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional))\n const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref)\n\n const mappedName = nameSchema?.args || propertyName\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${propertyName}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .filter((schema) => {\n return !isKeyword(schema, schemaKeywords.optional) && !isKeyword(schema, schemaKeywords.nullable) && !isKeyword(schema, schemaKeywords.nullish)\n })\n .map((it) => {\n // For v4 with refs, skip z.lazy wrapper since the getter provides lazy evaluation\n const skipLazyForRefs = options.version === '4' && hasRef\n return this.parse({ schema, parent: current, name, current: it, siblings: schemas }, { ...options, skipLazyForRefs })\n })\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: schema?.properties?.[propertyName] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (options.version === '4' && hasRef) {\n // In mini mode, use functional wrappers instead of chainable methods\n if (options.mini) {\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullish(objectValue)}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.optional(objectValue)}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullable(objectValue)}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // Non-mini mode uses chainable methods\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullish()}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.optional()}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullable()}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // both optional and nullable\n if (isNullish && options.mini) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullish(objectValue)}`\n }\n\n if (isNullish && !options.mini) {\n return `\"${propertyName}\": ${objectValue}${zodKeywordMapper.nullish()}`\n }\n\n // undefined\n if (isOptional) {\n return `\"${propertyName}\": ${zodKeywordMapper.optional(objectValue)}`\n }\n\n // null\n if (isNullable) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullable(objectValue)}`\n }\n\n return `\"${propertyName}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n zodKeywordMapper.object(properties, current.args?.strict, options.version),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.tuple(\n current.args.items.map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options)).filter(Boolean),\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number(current.args.value))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(typeof current.args.value === 'boolean' ? current.args.value : undefined)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n },\n matches(tree, options) {\n const { current, siblings } = tree\n\n // Early exit: if siblings contain both matches and ref → skip matches entirely\n const hasRef = siblings.some((it) => isKeyword(it, schemaKeywords.ref))\n if (hasRef) {\n return undefined // strip matches\n }\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n if (current.args) {\n return zodKeywordMapper.matches(\n transformers.toRegExpString(current.args, null),\n shouldCoerce(options.coercion, 'strings'),\n options.mini,\n minSchema?.args,\n maxSchema?.args,\n )\n }\n return undefined\n },\n default(tree, options) {\n const { current } = tree\n\n // In mini mode, default is handled by wrapWithMiniModifiers\n if (options.mini) {\n return undefined\n }\n if (current.args !== undefined) {\n return zodKeywordMapper.default(current.args)\n }\n // When args is undefined, call the mapper without arguments\n return zodKeywordMapper.default()\n },\n describe(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), undefined, options.mini)\n }\n return undefined\n },\n string(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'), minSchema?.args, maxSchema?.args, options.mini)\n },\n uuid(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n email(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n url(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n number(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.number(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n integer(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.integer(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n options.version,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n datetime(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini)\n },\n date(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n time(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n schema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n version: '3' | '4'\n emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType']\n mini?: boolean\n}\n\nexport function Zod({\n name,\n typeName,\n tree,\n schema,\n inferTypeName,\n mapper,\n coercion,\n keysToOmit,\n description,\n wrapOutput,\n version,\n emptySchemaType,\n mini = false,\n}: Props): KubbNode {\n const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple)\n\n const schemas = parserZod.sort(tree).filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n\n // In mini mode, filter out modifiers from the main schema parsing\n const baseSchemas = mini ? parserZod.filterMiniModifiers(schemas) : schemas\n\n const output = baseSchemas\n .map((schemaKeyword, index) => {\n const siblings = baseSchemas.filter((_, i) => i !== index)\n\n return parserZod.parse({ schema, parent: undefined, current: schemaKeyword, siblings, name }, { mapper, coercion, wrapOutput, version, mini })\n })\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n const firstSchema = schemas.at(0)\n const lastSchema = schemas.at(-1)\n\n if (!mini && lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap().unwrap()'\n }\n } else {\n suffix = '.unwrap()'\n }\n } else if (!mini) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.schema'\n } else {\n suffix = '.unwrap()'\n }\n }\n }\n\n const emptyValue = parserZod.parse(\n {\n schema,\n parent: undefined,\n current: {\n keyword: schemaKeywords[emptySchemaType],\n },\n siblings: [],\n },\n { mapper, coercion, wrapOutput, version, mini },\n )\n\n let baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n emptyValue ||\n ''\n\n // For mini mode, wrap the output with modifiers using the parser function\n if (mini) {\n baseSchemaOutput = parserZod.wrapWithMiniModifiers(baseSchemaOutput, parserZod.extractMiniModifiers(schemas))\n }\n\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ${version === '4' ? 'z.ZodType' : 'ToZod'}<${typeName}>` : wrappedSchemaOutput\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const\n export\n name={name}\n JSDoc={{\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }}\n >\n {finalOutput}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n {typeName && (\n <Type export name={inferTypeName}>\n {typeName}\n </Type>\n )}\n {!typeName && (\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n )}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAgB,WAAW,EAAE,MAAM,cAA+B;CAChE,MAAM,iBAAiB,WAAW,QAC/B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,gBAAgB,CAAC,MAAM,IAAI;AAElD,SAAO;IAET,EAAE,CACH;CAED,MAAM,YAAY,WAAW,QAC1B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,KAAK,MAAM;GAChC,GAAI,KAAK,IAAI,IAAI,UAAU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GAEG,IAEf"}
|
|
1
|
+
{"version":3,"file":"components-Cs1U51T4.cjs","names":["File","Type","Const","transformers","schemaKeywords","transformers","schema","SchemaGenerator","SchemaGenerator","schemaKeywords","parserZod.sort","parserZod.filterMiniModifiers","parserZod.parse","parserZod.wrapWithMiniModifiers","parserZod.extractMiniModifiers","File","Const","transformers","Type"],"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): FabricReactNode {\n const operationsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.getOperationId()}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.path}\"`] = {\n ...(prev[`\"${acc.operation.path}\"`] || ({} as Record<HttpMethod, string>)),\n [acc.operation.method]: `operations[\"${acc.operation.getOperationId()}\"]`,\n }\n\n return prev\n },\n {} as Record<string, Record<HttpMethod, string>>,\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 {`{${transformers.stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${transformers.stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import transformers from '@kubb/core/transformers'\n\nimport type { Schema, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, SchemaGenerator, type SchemaKeywordMapper, schemaKeywords } from '@kubb/plugin-oas'\n\n//TODO add zodKeywordMapper as function that returns 3 versions: v3, v4 and v4 mini, this can also be used to have the custom mapping(see object type)\n// also include shouldCoerce\n\n/**\n * Helper to build string/array length constraint checks for Zod Mini mode\n */\nfunction buildLengthChecks(min?: number, max?: number): string[] {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n return checks\n}\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number, exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.number().check(${checks.join(', ')})`\n }\n return 'z.number()'\n }\n return [\n coercion ? 'z.coerce.number()' : 'z.number()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number, version: '3' | '4' = '3', exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.int().check(${checks.join(', ')})`\n }\n return 'z.int()'\n }\n return [\n coercion ? 'z.coerce.number().int()' : version === '4' ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n interface: (value?: string, strict?: boolean) => {\n if (strict) {\n return `z.strictInterface({\n ${value}\n })`\n }\n return `z.interface({\n ${value}\n })`\n },\n object: (value?: string, strict?: boolean, version: '3' | '4' = '3') => {\n if (version === '4' && strict) {\n return `z.strictObject({\n ${value}\n })`\n }\n\n if (strict) {\n return `z.object({\n ${value}\n }).strict()`\n }\n\n return `z.object({\n ${value}\n })`\n },\n string: (coercion?: boolean, min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.string().check(${checks.join(', ')})`\n }\n return 'z.string()'\n }\n return [coercion ? 'z.coerce.string()' : 'z.string()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n //support for discriminatedUnion\n boolean: () => 'z.boolean()',\n undefined: () => 'z.undefined()',\n nullable: (value?: string) => {\n if (value) {\n return `z.nullable(${value})`\n }\n return '.nullable()'\n },\n null: () => 'z.null()',\n nullish: (value?: string) => {\n if (value) {\n return `z.nullish(${value})`\n }\n return '.nullish()'\n },\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (unique) checks.push(`z.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`)\n if (checks.length > 0) {\n return `z.array(${items?.join('')}).check(${checks.join(', ')})`\n }\n return `z.array(${items?.join('')})`\n }\n return [\n `z.array(${items?.join('')})`,\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n unique ? `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n tuple: (items: string[] = []) => `z.tuple([${items?.join(', ')}])`,\n enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`,\n union: (items: string[] = []) => `z.union([${items?.join(', ')}])`,\n const: (value?: string | number | boolean) => `z.literal(${value ?? ''})`,\n /**\n * ISO 8601\n */\n datetime: (offset = false, local = false, version: '3' | '4' = '3', mini?: boolean) => {\n // Zod Mini doesn't support .datetime() method, use plain string\n if (mini) {\n return 'z.string()'\n }\n\n if (offset) {\n return version === '4' ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return version === '4' ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return version === '4' ? 'z.iso.datetime()' : 'z.string().datetime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.date()' : 'z.string().date()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.time()' : 'z.string().time()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n uuid: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.uuid().check(${checks.join(', ')})`\n }\n return 'z.uuid()'\n }\n return [\n coercion ? (version === '4' ? 'z.uuid()' : 'z.coerce.string().uuid()') : version === '4' ? 'z.uuid()' : 'z.string().uuid()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n url: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.url().check(${checks.join(', ')})`\n }\n return 'z.url()'\n }\n return [\n coercion ? (version === '4' ? 'z.url()' : 'z.coerce.string().url()') : version === '4' ? 'z.url()' : 'z.string().url()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n default: (value?: string | number | boolean | object, innerSchema?: string, mini?: boolean) => {\n if (mini && innerSchema) {\n const defaultValue = typeof value === 'object' ? '{}' : (value ?? '')\n return `z._default(${innerSchema}, ${defaultValue})`\n }\n\n if (typeof value === 'object') {\n return '.default({})'\n }\n\n if (value === undefined) {\n return '.default()'\n }\n\n if (typeof value === 'string' && !value) {\n return `.default('')`\n }\n\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = [], mini?: boolean) => {\n // zod/mini doesn't support .and() method, so we can't use intersection types\n // In mini mode, we try to extract and append .check() calls instead\n if (mini && items.length > 0) {\n // Try to extract check calls from additional items\n const checks: string[] = []\n for (const item of items) {\n // Extract .check(...) from patterns like \"z.string().check(...)\"\n // Need to handle nested parentheses properly\n const checkStart = item.indexOf('.check(')\n if (checkStart !== -1) {\n // Find the matching closing parenthesis\n let depth = 0\n let i = checkStart + 7 // length of '.check('\n let checkContent = ''\n while (i < item.length) {\n const char = item[i]\n if (char === '(') depth++\n else if (char === ')') {\n if (depth === 0) break\n depth--\n }\n checkContent += char\n i++\n }\n if (checkContent) {\n checks.push(checkContent)\n }\n }\n }\n\n if (checks.length > 0) {\n // Append checks to the base schema\n return `.check(${checks.join(', ')})`\n }\n\n // If we can't extract checks, just use the first schema (limitation)\n return ''\n }\n return items?.map((item) => `.and(${item})`).join('')\n },\n describe: (value = '', innerSchema?: string, mini?: boolean) => {\n if (mini) {\n return undefined\n }\n\n if (innerSchema) {\n return `z.describe(${innerSchema}, ${value})`\n }\n return `.describe(${value})`\n },\n max: undefined,\n min: undefined,\n optional: (value?: string) => {\n if (value) {\n return `z.optional(${value})`\n }\n return '.optional()'\n },\n matches: (value = '', coercion?: boolean, mini?: boolean, min?: number, max?: number) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n checks.push(`z.regex(${value})`)\n return `z.string().check(${checks.join(', ')})`\n }\n return [\n coercion ? 'z.coerce.string()' : 'z.string()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n `.regex(${value})`,\n ]\n .filter(Boolean)\n .join('')\n },\n email: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.email().check(${checks.join(', ')})`\n }\n return 'z.email()'\n }\n return [\n coercion ? (version === '4' ? 'z.email()' : 'z.coerce.string().email()') : version === '4' ? 'z.email()' : 'z.string().email()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (value?: string) => {\n if (!value) {\n return undefined\n }\n\n return `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string, mini?: boolean) => {\n // Zod Mini doesn't support .catchall() method\n if (mini) {\n return undefined\n }\n return value ? `.catchall(${value})` : undefined\n },\n name: undefined,\n exclusiveMinimum: undefined,\n exclusiveMaximum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nexport function sort(items?: Schema[]): Schema[] {\n const order: string[] = [\n schemaKeywords.string,\n schemaKeywords.datetime,\n schemaKeywords.date,\n schemaKeywords.time,\n schemaKeywords.tuple,\n schemaKeywords.number,\n schemaKeywords.object,\n schemaKeywords.enum,\n schemaKeywords.url,\n schemaKeywords.email,\n schemaKeywords.firstName,\n schemaKeywords.lastName,\n schemaKeywords.password,\n schemaKeywords.matches,\n schemaKeywords.uuid,\n schemaKeywords.null,\n schemaKeywords.min,\n schemaKeywords.max,\n schemaKeywords.default,\n schemaKeywords.describe,\n schemaKeywords.optional,\n schemaKeywords.nullable,\n schemaKeywords.nullish,\n ]\n\n if (!items) {\n return []\n }\n\n return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ['asc'])\n}\n\ntype MiniModifiers = {\n hasOptional?: boolean\n hasNullable?: boolean\n hasNullish?: boolean\n defaultValue?: string | number | true | object\n}\n\n/**\n * Keywords that represent modifiers for mini mode\n * These are separated from the base schema and wrapped around it\n * Note: describe is included to filter it out, but won't be wrapped (Zod Mini doesn't support describe)\n */\nexport const miniModifierKeywords = [schemaKeywords.optional, schemaKeywords.nullable, schemaKeywords.nullish, schemaKeywords.default, schemaKeywords.describe]\n\n/**\n * Extracts mini mode modifiers from a schemas array\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n * Note: describe is not included as Zod Mini doesn't support it\n */\nexport function extractMiniModifiers(schemas: Schema[]): MiniModifiers {\n const defaultSchema = schemas.find((item) => isKeyword(item, schemaKeywords.default)) as { keyword: string; args: unknown } | undefined\n\n return {\n hasOptional: schemas.some((item) => isKeyword(item, schemaKeywords.optional)),\n hasNullable: schemas.some((item) => isKeyword(item, schemaKeywords.nullable)),\n hasNullish: schemas.some((item) => isKeyword(item, schemaKeywords.nullish)),\n defaultValue: defaultSchema?.args as string | number | true | object | undefined,\n }\n}\n\n/**\n * Filters out modifier keywords from schemas for mini mode base schema parsing\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n */\nexport function filterMiniModifiers(schemas: Schema[]): Schema[] {\n return schemas.filter((item) => !miniModifierKeywords.some((keyword) => isKeyword(item, keyword)))\n}\n\n/**\n * Wraps an output string with Zod Mini functional modifiers\n * Order: default (innermost) -> nullable -> optional (outermost)\n * OR: default -> nullish\n * Note: describe is not supported in Zod Mini and is skipped\n */\nexport function wrapWithMiniModifiers(output: string, modifiers: MiniModifiers): string {\n let result = output\n\n // Apply default first (innermost wrapper)\n if (modifiers.defaultValue !== undefined) {\n result = zodKeywordMapper.default(modifiers.defaultValue, result, true)!\n }\n\n // Apply nullish, nullable, or optional (outer wrappers for optionality)\n if (modifiers.hasNullish) {\n result = zodKeywordMapper.nullish(result)!\n } else {\n if (modifiers.hasNullable) {\n result = zodKeywordMapper.nullable(result)!\n }\n if (modifiers.hasOptional) {\n result = zodKeywordMapper.optional(result)!\n }\n }\n\n return result\n}\n\nconst shouldCoerce = (coercion: ParserOptions['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean => {\n if (coercion === undefined) {\n return false\n }\n if (typeof coercion === 'boolean') {\n return coercion\n }\n\n return !!coercion[type]\n}\n\ntype ParserOptions = {\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n version: '3' | '4'\n skipLazyForRefs?: boolean\n mini?: boolean\n}\n\n// Create the parser using createParser\nexport const parse = createParser<string, ParserOptions>({\n mapper: zodKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, parent, name, siblings } = tree\n\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return this.parse({ schema, parent, name, current: current.args[0] as Schema, siblings }, options)\n }\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return zodKeywordMapper.union(\n sort(current.args)\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean),\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n const items = sort(current.args)\n .filter((schema: Schema) => {\n return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema.keyword as typeof schemaKeywords.describe)\n })\n .map((it: Schema, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n options.mini,\n )\n },\n enum(tree, options) {\n const { current, schema, name } = tree\n\n if (current.args.asConst) {\n if (current.args.items.length === 1) {\n const child = {\n keyword: schemaKeywords.const,\n args: current.args.items[0],\n }\n return this.parse({ schema, parent: current, name, current: child, siblings: [child] }, options)\n }\n\n return zodKeywordMapper.union(\n current.args.items\n .map((schema) => ({\n keyword: schemaKeywords.const,\n args: schema,\n }))\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n )\n }\n\n return zodKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'boolean') {\n return transformers.stringify(schema.value)\n }\n\n if (schema.format === 'number') {\n return transformers.stringify(schema.value)\n }\n return transformers.stringify(schema.value)\n }),\n )\n },\n ref(tree, options) {\n const { current } = tree\n\n // Skip z.lazy wrapper if skipLazyForRefs is true (e.g., inside v4 getters)\n if (options.skipLazyForRefs) {\n return current.args?.name\n }\n return zodKeywordMapper.ref(current.args?.name)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\n const propertyEntries = Object.entries(current.args?.properties || {}).filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n\n const properties = propertyEntries\n .map(([propertyName, schemas]) => {\n const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable))\n const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish))\n const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional))\n const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref)\n\n const mappedName = nameSchema?.args || propertyName\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${propertyName}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .filter((schema) => {\n return !isKeyword(schema, schemaKeywords.optional) && !isKeyword(schema, schemaKeywords.nullable) && !isKeyword(schema, schemaKeywords.nullish)\n })\n .map((it) => {\n // For v4 with refs, skip z.lazy wrapper since the getter provides lazy evaluation\n const skipLazyForRefs = options.version === '4' && hasRef\n return this.parse({ schema, parent: current, name, current: it, siblings: schemas }, { ...options, skipLazyForRefs })\n })\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: schema?.properties?.[propertyName] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (options.version === '4' && hasRef) {\n // In mini mode, use functional wrappers instead of chainable methods\n if (options.mini) {\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullish(objectValue)}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.optional(objectValue)}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullable(objectValue)}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // Non-mini mode uses chainable methods\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullish()}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.optional()}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullable()}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // both optional and nullable\n if (isNullish && options.mini) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullish(objectValue)}`\n }\n\n if (isNullish && !options.mini) {\n return `\"${propertyName}\": ${objectValue}${zodKeywordMapper.nullish()}`\n }\n\n // undefined\n if (isOptional) {\n return `\"${propertyName}\": ${zodKeywordMapper.optional(objectValue)}`\n }\n\n // null\n if (isNullable) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullable(objectValue)}`\n }\n\n return `\"${propertyName}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n zodKeywordMapper.object(properties, current.args?.strict, options.version),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.tuple(\n current.args.items.map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options)).filter(Boolean),\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number(current.args.value))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(typeof current.args.value === 'boolean' ? current.args.value : undefined)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n },\n matches(tree, options) {\n const { current, siblings } = tree\n\n // Early exit: if siblings contain both matches and ref → skip matches entirely\n const hasRef = siblings.some((it) => isKeyword(it, schemaKeywords.ref))\n if (hasRef) {\n return undefined // strip matches\n }\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n if (current.args) {\n return zodKeywordMapper.matches(\n transformers.toRegExpString(current.args, null),\n shouldCoerce(options.coercion, 'strings'),\n options.mini,\n minSchema?.args,\n maxSchema?.args,\n )\n }\n return undefined\n },\n default(tree, options) {\n const { current } = tree\n\n // In mini mode, default is handled by wrapWithMiniModifiers\n if (options.mini) {\n return undefined\n }\n if (current.args !== undefined) {\n return zodKeywordMapper.default(current.args)\n }\n // When args is undefined, call the mapper without arguments\n return zodKeywordMapper.default()\n },\n describe(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), undefined, options.mini)\n }\n return undefined\n },\n string(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'), minSchema?.args, maxSchema?.args, options.mini)\n },\n uuid(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n email(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n url(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n number(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.number(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n integer(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.integer(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n options.version,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n datetime(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini)\n },\n date(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n time(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n schema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n version: '3' | '4'\n emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType']\n mini?: boolean\n}\n\nexport function Zod({\n name,\n typeName,\n tree,\n schema,\n inferTypeName,\n mapper,\n coercion,\n keysToOmit,\n description,\n wrapOutput,\n version,\n emptySchemaType,\n mini = false,\n}: Props): FabricReactNode {\n const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple)\n\n const schemas = parserZod.sort(tree).filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n\n // In mini mode, filter out modifiers from the main schema parsing\n const baseSchemas = mini ? parserZod.filterMiniModifiers(schemas) : schemas\n\n const output = baseSchemas\n .map((schemaKeyword, index) => {\n const siblings = baseSchemas.filter((_, i) => i !== index)\n\n return parserZod.parse({ schema, parent: undefined, current: schemaKeyword, siblings, name }, { mapper, coercion, wrapOutput, version, mini })\n })\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n const firstSchema = schemas.at(0)\n const lastSchema = schemas.at(-1)\n\n if (!mini && lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap().unwrap()'\n }\n } else {\n suffix = '.unwrap()'\n }\n } else if (!mini) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.schema'\n } else {\n suffix = '.unwrap()'\n }\n }\n }\n\n const emptyValue = parserZod.parse(\n {\n schema,\n parent: undefined,\n current: {\n keyword: schemaKeywords[emptySchemaType],\n },\n siblings: [],\n },\n { mapper, coercion, wrapOutput, version, mini },\n )\n\n let baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n emptyValue ||\n ''\n\n // For mini mode, wrap the output with modifiers using the parser function\n if (mini) {\n baseSchemaOutput = parserZod.wrapWithMiniModifiers(baseSchemaOutput, parserZod.extractMiniModifiers(schemas))\n }\n\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ${version === '4' ? 'z.ZodType' : 'ToZod'}<${typeName}>` : wrappedSchemaOutput\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const\n export\n name={name}\n JSDoc={{\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }}\n >\n {finalOutput}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n {typeName && (\n <Type export name={inferTypeName}>\n {typeName}\n </Type>\n )}\n {!typeName && (\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n )}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAgB,WAAW,EAAE,MAAM,cAAsC;CACvE,MAAM,iBAAiB,WAAW,QAC/B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI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A;IACK;GACI,EACb,iBACC,yDAACF,wBAAK;EAAO,MAAM;EAAe;EAAa;EAAY;aACxD,YACC,wDAACG;GAAK;GAAO,MAAM;aAChB;IACI,EAER,CAAC,YACA,wDAACA;GAAK;GAAO,MAAM;aAChB,kBAAkB,KAAK;IACnB;GAEG,IAEf"}
|
package/dist/components.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as __name, i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-
|
|
1
|
+
import { c as __name, i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-HQfz08mH.cjs";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
-
import {
|
|
3
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region ../plugin-oas/src/hooks/useOperationManager.d.ts
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ type Props$1 = {
|
|
|
28
28
|
declare function Operations({
|
|
29
29
|
name,
|
|
30
30
|
operations
|
|
31
|
-
}: Props$1):
|
|
31
|
+
}: Props$1): FabricReactNode;
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/components/Zod.d.ts
|
|
34
34
|
type Props = {
|
|
@@ -60,7 +60,7 @@ declare function Zod({
|
|
|
60
60
|
version,
|
|
61
61
|
emptySchemaType,
|
|
62
62
|
mini
|
|
63
|
-
}: Props):
|
|
63
|
+
}: Props): FabricReactNode;
|
|
64
64
|
//#endregion
|
|
65
65
|
export { Operations, Zod };
|
|
66
66
|
//# sourceMappingURL=components.d.cts.map
|
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-
|
|
2
|
+
import { i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-BBLRijaO.js";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
-
import {
|
|
4
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
6
6
|
//#region ../plugin-oas/src/hooks/useOperationManager.d.ts
|
|
7
7
|
|
|
@@ -29,7 +29,7 @@ type Props$1 = {
|
|
|
29
29
|
declare function Operations({
|
|
30
30
|
name,
|
|
31
31
|
operations
|
|
32
|
-
}: Props$1):
|
|
32
|
+
}: Props$1): FabricReactNode;
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/components/Zod.d.ts
|
|
35
35
|
type Props = {
|
|
@@ -61,7 +61,7 @@ declare function Zod({
|
|
|
61
61
|
version,
|
|
62
62
|
emptySchemaType,
|
|
63
63
|
mini
|
|
64
|
-
}: Props):
|
|
64
|
+
}: Props): FabricReactNode;
|
|
65
65
|
//#endregion
|
|
66
66
|
export { Operations, Zod };
|
|
67
67
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/components.js
CHANGED
|
@@ -140,7 +140,7 @@ const zodGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
140
140
|
group
|
|
141
141
|
})
|
|
142
142
|
};
|
|
143
|
-
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(
|
|
143
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
144
144
|
typed && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
145
145
|
isTypeOnly: true,
|
|
146
146
|
root: file.path,
|
|
@@ -285,4 +285,4 @@ Object.defineProperty(exports, 'zodGenerator', {
|
|
|
285
285
|
return zodGenerator;
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
|
-
//# sourceMappingURL=generators-
|
|
288
|
+
//# sourceMappingURL=generators-BeILgXPF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-BeILgXPF.cjs","names":["File","Operations","SchemaGenerator","options","schemaKeywords","pluginTsName","File","path","Zod"],"sources":["../src/generators/operationsGenerator.tsx","../src/generators/zodGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations.tsx'\nimport type { PluginZod } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginZod>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const {\n key: pluginKey,\n options: { output, importPath },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getFile, groupSchemasByName } = useOperationManager(generator)\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n const transformedOperations = operations.map((operation) => ({ operation, data: groupSchemasByName(operation, { type: 'function' }) }))\n\n const imports = Object.entries(transformedOperations)\n .map(([key, { data, operation }]) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean)\n\n return <File.Import key={key} name={names} root={file.path} path={getFile(operation).path} />\n })\n .filter(Boolean)\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import isTypeOnly name={['z']} path={importPath} />\n {imports}\n <Operations name={name} operations={transformedOperations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Zod } from '../components'\nimport type { PluginZod } from '../types'\n\nexport const zodGenerator = createReactGenerator<PluginZod>({\n name: 'zod',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version, mini },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n plugin,\n pluginManager,\n events: generator.context.events,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }: OperationSchemaType) => {\n let schemaObject = schemaOriginal\n let keysToOmit = keysToOmitOriginal\n\n if ((schemaOriginal.anyOf || schemaOriginal.oneOf) && keysToOmitOriginal && keysToOmitOriginal.length > 0) {\n schemaObject = structuredClone(schemaOriginal)\n\n // Remove $ref so the schema parser generates inline schema instead of a reference\n delete schemaObject.$ref\n\n for (const key of keysToOmitOriginal) {\n delete schemaObject.properties?.[key]\n }\n\n if (Array.isArray(schemaObject.required)) {\n schemaObject.required = schemaObject.required.filter((key) => !keysToOmitOriginal.includes(key))\n }\n\n keysToOmit = undefined\n }\n\n const hasProperties = Object.keys(schemaObject || {}).length > 0\n const hasDefaults = Object.values(schemaObject.properties || {}).some((prop) => prop && Object.hasOwn(prop, 'default'))\n\n const required = Array.isArray(schemaObject?.required) ? schemaObject.required.length > 0 : !!schemaObject?.required\n const optional = !required && !hasDefaults && hasProperties && name.includes('Params')\n\n if (!optional && Array.isArray(schemaObject.required) && !schemaObject.required.length) {\n schemaObject.required = Object.entries(schemaObject.properties || {})\n .filter(([_key, value]) => value && Object.hasOwn(value, 'default'))\n .map(([key]) => key)\n }\n\n const tree = [\n ...schemaGenerator.parse({ schema: schemaObject, name, parentName: null }),\n optional ? { keyword: schemaKeywords.optional } : undefined,\n ].filter(Boolean)\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const coercion = name.includes('Params') ? { numbers: true, strings: false, dates: true } : globalCoercion\n\n const zod = {\n name: schemaManager.getName(name, { type: 'function' }),\n inferTypeName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, {\n type: 'type',\n pluginKey: [pluginTsName],\n }),\n file: schemaManager.getFile(options.operationName || name, {\n pluginKey: [pluginTsName],\n group,\n }),\n }\n\n return (\n <>\n {typed && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && <File.Import name={['ToZod']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n coercion={coercion}\n keysToOmit={keysToOmit}\n wrapOutput={wrapOutput}\n version={plugin.options.version}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['z']} path={plugin.options.importPath} />\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile, getImports } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, mini },\n } = plugin\n const pluginManager = usePluginManager()\n const oas = useOas()\n\n const imports = getImports(schema.tree)\n\n const zod = {\n name: getName(schema.name, { type: 'function' }),\n inferTypeName: getName(schema.name, { type: 'type' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginKey: [pluginTsName] }),\n file: getFile(schema.name, { pluginKey: [pluginTsName] }),\n }\n\n return (\n <File\n baseName={zod.file.baseName}\n path={zod.file.path}\n meta={zod.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['z']} path={importPath} />\n {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && (\n <File.Import name={['ToZod']} root={zod.file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />\n )}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={zod.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n coercion={coercion}\n wrapOutput={wrapOutput}\n version={version}\n emptySchemaType={emptySchemaType}\n mini={mini}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAa,4EAAsD;CACjE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,UAAU;EAC5C,MAAM,EACJ,KAAK,WACL,SAAS,EAAE,QAAQ,iBACjB;EACJ,MAAM,wDAAkC;EAExC,MAAM,0CAAc;EACpB,MAAM,EAAE,SAAS,uEAA2C,UAAU;EAEtE,MAAM,OAAO;EACb,MAAM,OAAO,cAAc,QAAQ;GAAE;GAAM,SAAS;GAAO;GAAW,CAAC;EAEvE,MAAM,wBAAwB,WAAW,KAAK,eAAe;GAAE;GAA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AAC,KAAK,KAAK;MAAI;IACjG,SAAS,YAAY,OACpB,wDAACA,wBAAK;KAAO,MAAM,CAAC,QAAQ;KAAE,MAAM,IAAI,KAAK;KAAM,MAAMC,kBAAK,QAAQ,OAAO,MAAM,OAAO,OAAO,MAAM,iBAAiB;MAAI;IAE7H,QAAQ,KAAK,QACZ,wDAACD,wBAAK;KAA4D,MAAM,IAAI,KAAK;KAAM,MAAM,IAAI;KAAM,MAAM,IAAI;OAA/F;KAAC,IAAI;KAAM,IAAI;KAAM,IAAI;KAAW,CAAC,KAAK,IAAI,CAAyD,CACzH;IAEF,wDAACE;KACC,MAAM,IAAI;KACV,UAAU,QAAQ,KAAK,OAAO;KAC9B,eAAe,WAAW,IAAI,gBAAgB;KAC9C,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACb,QAAQ,OAAO;KACP;KACE;KACE;KACH;KACQ;KACX;MACN;;IACG;;CAGZ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as Operations, t as Zod } from "./components-
|
|
2
|
+
import { n as Operations, t as Zod } from "./components-BmXLaLL5.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { SchemaGenerator, schemaKeywords } from "@kubb/plugin-oas";
|
|
5
5
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
@@ -7,8 +7,8 @@ import { useMode, usePluginManager } from "@kubb/core/hooks";
|
|
|
7
7
|
import { createReactGenerator } from "@kubb/plugin-oas/generators";
|
|
8
8
|
import { useOas, useOperationManager, useSchemaManager } from "@kubb/plugin-oas/hooks";
|
|
9
9
|
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
10
|
-
import { File
|
|
11
|
-
import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
10
|
+
import { File } from "@kubb/react-fabric";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/generators/operationsGenerator.tsx
|
|
14
14
|
const operationsGenerator = createReactGenerator({
|
|
@@ -274,4 +274,4 @@ const zodGenerator = createReactGenerator({
|
|
|
274
274
|
|
|
275
275
|
//#endregion
|
|
276
276
|
export { operationsGenerator as n, zodGenerator as t };
|
|
277
|
-
//# sourceMappingURL=generators-
|
|
277
|
+
//# sourceMappingURL=generators-WdjCkovi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-WdjCkovi.js","names":["options"],"sources":["../src/generators/operationsGenerator.tsx","../src/generators/zodGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations.tsx'\nimport type { PluginZod } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginZod>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const {\n key: pluginKey,\n options: { output, importPath },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getFile, groupSchemasByName } = useOperationManager(generator)\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n const transformedOperations = operations.map((operation) => ({ operation, data: groupSchemasByName(operation, { type: 'function' }) }))\n\n const imports = Object.entries(transformedOperations)\n .map(([key, { data, operation }]) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean)\n\n return <File.Import key={key} name={names} root={file.path} path={getFile(operation).path} />\n })\n .filter(Boolean)\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import isTypeOnly name={['z']} path={importPath} />\n {imports}\n <Operations name={name} operations={transformedOperations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Zod } from '../components'\nimport type { PluginZod } from '../types'\n\nexport const zodGenerator = createReactGenerator<PluginZod>({\n name: 'zod',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version, mini },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n plugin,\n pluginManager,\n events: generator.context.events,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }: OperationSchemaType) => {\n let schemaObject = schemaOriginal\n let keysToOmit = keysToOmitOriginal\n\n if ((schemaOriginal.anyOf || schemaOriginal.oneOf) && keysToOmitOriginal && keysToOmitOriginal.length > 0) {\n schemaObject = structuredClone(schemaOriginal)\n\n // Remove $ref so the schema parser generates inline schema instead of a reference\n delete schemaObject.$ref\n\n for (const key of keysToOmitOriginal) {\n delete schemaObject.properties?.[key]\n }\n\n if (Array.isArray(schemaObject.required)) {\n schemaObject.required = schemaObject.required.filter((key) => !keysToOmitOriginal.includes(key))\n }\n\n keysToOmit = undefined\n }\n\n const hasProperties = Object.keys(schemaObject || {}).length > 0\n const hasDefaults = Object.values(schemaObject.properties || {}).some((prop) => prop && Object.hasOwn(prop, 'default'))\n\n const required = Array.isArray(schemaObject?.required) ? schemaObject.required.length > 0 : !!schemaObject?.required\n const optional = !required && !hasDefaults && hasProperties && name.includes('Params')\n\n if (!optional && Array.isArray(schemaObject.required) && !schemaObject.required.length) {\n schemaObject.required = Object.entries(schemaObject.properties || {})\n .filter(([_key, value]) => value && Object.hasOwn(value, 'default'))\n .map(([key]) => key)\n }\n\n const tree = [\n ...schemaGenerator.parse({ schema: schemaObject, name, parentName: null }),\n optional ? { keyword: schemaKeywords.optional } : undefined,\n ].filter(Boolean)\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const coercion = name.includes('Params') ? { numbers: true, strings: false, dates: true } : globalCoercion\n\n const zod = {\n name: schemaManager.getName(name, { type: 'function' }),\n inferTypeName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, {\n type: 'type',\n pluginKey: [pluginTsName],\n }),\n file: schemaManager.getFile(options.operationName || name, {\n pluginKey: [pluginTsName],\n group,\n }),\n }\n\n return (\n <>\n {typed && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && <File.Import name={['ToZod']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n coercion={coercion}\n keysToOmit={keysToOmit}\n wrapOutput={wrapOutput}\n version={plugin.options.version}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['z']} path={plugin.options.importPath} />\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile, getImports } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, mini },\n } = plugin\n const pluginManager = usePluginManager()\n const oas = useOas()\n\n const imports = getImports(schema.tree)\n\n const zod = {\n name: getName(schema.name, { type: 'function' }),\n inferTypeName: getName(schema.name, { type: 'type' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginKey: [pluginTsName] }),\n file: getFile(schema.name, { pluginKey: [pluginTsName] }),\n }\n\n return (\n <File\n baseName={zod.file.baseName}\n path={zod.file.path}\n meta={zod.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['z']} path={importPath} />\n {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && (\n <File.Import name={['ToZod']} root={zod.file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />\n )}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={zod.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n coercion={coercion}\n wrapOutput={wrapOutput}\n version={version}\n emptySchemaType={emptySchemaType}\n mini={mini}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAa,sBAAsB,qBAAgC;CACjE,MAAM;CACN,WAAW,EAAE,YAAY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Aa,EAAE,CAAC;GAC1D;AAED,SACE,qBAAC;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,QAAQ,UAAU;IAAE;IAAK;IAAQ,CAAC;;IAElC,oBAAC,KAAK;KAAO,MAAM,CAAC,IAAI;KAAE,MAAM;MAAc;IAC7C,SAAS,oBAAC,KAAK;KAAO;KAAW,MAAM,IAAI,KAAK;KAAM,MAAM,KAAK,KAAK;KAAM,MAAM,CAAC,KAAK,KAAK;MAAI;IACjG,SAAS,YAAY,OACpB,oBAAC,KAAK;KAAO,MAAM,CAAC,QAAQ;KAAE,MAAM,IAAI,KAAK;KAAM,MAAM,KAAK,QAAQ,OAAO,MAAM,OAAO,OAAO,MAAM,iBAAiB;MAAI;IAE7H,QAAQ,KAAK,QACZ,oBAAC,KAAK;KAA4D,MAAM,IAAI,KAAK;KAAM,MAAM,IAAI;KAAM,MAAM,IAAI;OAA/F;KAAC,IAAI;KAAM,IAAI;KAAM,IAAI;KAAW,CAAC,KAAK,IAAI,CAAyD,CACzH;IAEF,oBAAC;KACC,MAAM,IAAI;KACV,UAAU,QAAQ,KAAK,OAAO;KAC9B,eAAe,WAAW,IAAI,gBAAgB;KAC9C,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACb,QAAQ,OAAO;KACP;KACE;KACE;KACH;KACQ;KACX;MACN;;IACG;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as __name, n as PluginZod, r as ReactGenerator } from "./types-
|
|
1
|
+
import { c as __name, n as PluginZod, r as ReactGenerator } from "./types-HQfz08mH.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/operationsGenerator.d.ts
|
|
4
4
|
declare const operationsGenerator: ReactGenerator<PluginZod>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as PluginZod, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginZod, r as ReactGenerator } from "./types-BBLRijaO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/operationsGenerator.d.ts
|
|
5
5
|
declare const operationsGenerator: ReactGenerator<PluginZod>;
|
package/dist/generators.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_components = require('./components-Cs1U51T4.cjs');
|
|
2
|
-
const require_generators = require('./generators-
|
|
2
|
+
const require_generators = require('./generators-BeILgXPF.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_components.__toESM(node_path);
|
|
5
5
|
let _kubb_core = require("@kubb/core");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, c as __name, n as PluginZod, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, c as __name, n as PluginZod, t as Options } from "./types-HQfz08mH.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginZodName = "plugin-zod";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { a as UserPluginWithLifeCycle, n as PluginZod, t as Options } from "./types-
|
|
2
|
+
import { a as UserPluginWithLifeCycle, n as PluginZod, t as Options } from "./types-BBLRijaO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginZodName = "plugin-zod";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as operationsGenerator, t as zodGenerator } from "./generators-
|
|
2
|
+
import { n as operationsGenerator, t as zodGenerator } from "./generators-WdjCkovi.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { PackageManager, definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
@@ -5,7 +5,7 @@ import BaseOas from "oas";
|
|
|
5
5
|
import { Operation } from "oas/operation";
|
|
6
6
|
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
7
7
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
-
import {
|
|
8
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
9
9
|
|
|
10
10
|
//#region ../oas/src/types.d.ts
|
|
11
11
|
type contentType = 'application/json' | (string & {});
|
|
@@ -1140,9 +1140,9 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
1140
1140
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1141
1141
|
name: string;
|
|
1142
1142
|
type: 'react';
|
|
1143
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
1144
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
1145
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
1143
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
1144
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
1145
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
1146
1146
|
};
|
|
1147
1147
|
//#endregion
|
|
1148
1148
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1351,4 +1351,4 @@ type ResolvedOptions = {
|
|
|
1351
1351
|
type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1352
1352
|
//#endregion
|
|
1353
1353
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginZod as n, Operation$1 as o, ReactGenerator as r, SchemaObject$1 as s, Options as t };
|
|
1354
|
-
//# sourceMappingURL=types-
|
|
1354
|
+
//# sourceMappingURL=types-BBLRijaO.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { Operation } from "oas/operation";
|
|
|
4
4
|
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
5
5
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
6
6
|
import { Fabric } from "@kubb/react-fabric";
|
|
7
|
-
import {
|
|
7
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
8
8
|
|
|
9
9
|
//#region rolldown:runtime
|
|
10
10
|
//#endregion
|
|
@@ -1141,9 +1141,9 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
1141
1141
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1142
1142
|
name: string;
|
|
1143
1143
|
type: 'react';
|
|
1144
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
1145
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
1146
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
1144
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
1145
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
1146
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
1147
1147
|
};
|
|
1148
1148
|
//#endregion
|
|
1149
1149
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1352,4 +1352,4 @@ type ResolvedOptions = {
|
|
|
1352
1352
|
type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1353
1353
|
//#endregion
|
|
1354
1354
|
export { UserPluginWithLifeCycle as a, __name as c, Schema as i, PluginZod as n, Operation$1 as o, ReactGenerator as r, SchemaObject$1 as s, Options as t };
|
|
1355
|
-
//# sourceMappingURL=types-
|
|
1355
|
+
//# sourceMappingURL=types-HQfz08mH.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-zod",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.20.1",
|
|
4
4
|
"description": "Zod schema generator plugin for Kubb, creating type-safe validation schemas from OpenAPI specifications for runtime data validation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@kubb/react-fabric": "0.12.
|
|
72
|
-
"@kubb/core": "4.
|
|
73
|
-
"@kubb/oas": "4.
|
|
74
|
-
"@kubb/plugin-oas": "4.
|
|
75
|
-
"@kubb/plugin-ts": "4.
|
|
71
|
+
"@kubb/react-fabric": "0.12.7",
|
|
72
|
+
"@kubb/core": "4.20.1",
|
|
73
|
+
"@kubb/oas": "4.20.1",
|
|
74
|
+
"@kubb/plugin-oas": "4.20.1",
|
|
75
|
+
"@kubb/plugin-ts": "4.20.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@asteasolutions/zod-to-openapi": "^8.4.0",
|
|
@@ -2,14 +2,14 @@ import transformers from '@kubb/core/transformers'
|
|
|
2
2
|
import type { HttpMethod, Operation } from '@kubb/oas'
|
|
3
3
|
import type { SchemaNames } from '@kubb/plugin-oas/hooks'
|
|
4
4
|
import { Const, File, Type } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
name: string
|
|
9
9
|
operations: Array<{ operation: Operation; data: SchemaNames }>
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function Operations({ name, operations }: Props):
|
|
12
|
+
export function Operations({ name, operations }: Props): FabricReactNode {
|
|
13
13
|
const operationsJSON = operations.reduce(
|
|
14
14
|
(prev, acc) => {
|
|
15
15
|
prev[`"${acc.operation.getOperationId()}"`] = acc.data
|
package/src/components/Zod.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import transformers from '@kubb/core/transformers'
|
|
|
2
2
|
import type { SchemaObject } from '@kubb/oas'
|
|
3
3
|
import { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'
|
|
4
4
|
import { Const, File, Type } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import * as parserZod from '../parser.ts'
|
|
7
7
|
import type { PluginZod } from '../types.ts'
|
|
8
8
|
|
|
@@ -36,7 +36,7 @@ export function Zod({
|
|
|
36
36
|
version,
|
|
37
37
|
emptySchemaType,
|
|
38
38
|
mini = false,
|
|
39
|
-
}: Props):
|
|
39
|
+
}: Props): FabricReactNode {
|
|
40
40
|
const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple)
|
|
41
41
|
|
|
42
42
|
const schemas = parserZod.sort(tree).filter((item) => {
|
|
@@ -5,7 +5,7 @@ import { createReactGenerator } from '@kubb/plugin-oas/generators'
|
|
|
5
5
|
import { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'
|
|
6
6
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
|
-
import { File
|
|
8
|
+
import { File } from '@kubb/react-fabric'
|
|
9
9
|
import { Zod } from '../components'
|
|
10
10
|
import type { PluginZod } from '../types'
|
|
11
11
|
|
|
@@ -100,7 +100,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
return (
|
|
103
|
-
|
|
103
|
+
<>
|
|
104
104
|
{typed && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}
|
|
105
105
|
{typed && version === '3' && <File.Import name={['ToZod']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />}
|
|
106
106
|
{imports.map((imp) => (
|
|
@@ -121,7 +121,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
121
121
|
emptySchemaType={plugin.options.emptySchemaType}
|
|
122
122
|
mini={mini}
|
|
123
123
|
/>
|
|
124
|
-
|
|
124
|
+
</>
|
|
125
125
|
)
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-BgtqtaQt.js","names":["schema","parserZod.sort","parserZod.filterMiniModifiers","parserZod.parse","parserZod.wrapWithMiniModifiers","parserZod.extractMiniModifiers"],"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbNode {\n const operationsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.getOperationId()}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.path}\"`] = {\n ...(prev[`\"${acc.operation.path}\"`] || ({} as Record<HttpMethod, string>)),\n [acc.operation.method]: `operations[\"${acc.operation.getOperationId()}\"]`,\n }\n\n return prev\n },\n {} as Record<string, Record<HttpMethod, string>>,\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 {`{${transformers.stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${transformers.stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import transformers from '@kubb/core/transformers'\n\nimport type { Schema, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, SchemaGenerator, type SchemaKeywordMapper, schemaKeywords } from '@kubb/plugin-oas'\n\n//TODO add zodKeywordMapper as function that returns 3 versions: v3, v4 and v4 mini, this can also be used to have the custom mapping(see object type)\n// also include shouldCoerce\n\n/**\n * Helper to build string/array length constraint checks for Zod Mini mode\n */\nfunction buildLengthChecks(min?: number, max?: number): string[] {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n return checks\n}\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number, exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.number().check(${checks.join(', ')})`\n }\n return 'z.number()'\n }\n return [\n coercion ? 'z.coerce.number()' : 'z.number()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number, version: '3' | '4' = '3', exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\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 (checks.length > 0) {\n return `z.int().check(${checks.join(', ')})`\n }\n return 'z.int()'\n }\n return [\n coercion ? 'z.coerce.number().int()' : version === '4' ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n interface: (value?: string, strict?: boolean) => {\n if (strict) {\n return `z.strictInterface({\n ${value}\n })`\n }\n return `z.interface({\n ${value}\n })`\n },\n object: (value?: string, strict?: boolean, version: '3' | '4' = '3') => {\n if (version === '4' && strict) {\n return `z.strictObject({\n ${value}\n })`\n }\n\n if (strict) {\n return `z.object({\n ${value}\n }).strict()`\n }\n\n return `z.object({\n ${value}\n })`\n },\n string: (coercion?: boolean, min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.string().check(${checks.join(', ')})`\n }\n return 'z.string()'\n }\n return [coercion ? 'z.coerce.string()' : 'z.string()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n //support for discriminatedUnion\n boolean: () => 'z.boolean()',\n undefined: () => 'z.undefined()',\n nullable: (value?: string) => {\n if (value) {\n return `z.nullable(${value})`\n }\n return '.nullable()'\n },\n null: () => 'z.null()',\n nullish: (value?: string) => {\n if (value) {\n return `z.nullish(${value})`\n }\n return '.nullish()'\n },\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (unique) checks.push(`z.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`)\n if (checks.length > 0) {\n return `z.array(${items?.join('')}).check(${checks.join(', ')})`\n }\n return `z.array(${items?.join('')})`\n }\n return [\n `z.array(${items?.join('')})`,\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n unique ? `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n tuple: (items: string[] = []) => `z.tuple([${items?.join(', ')}])`,\n enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`,\n union: (items: string[] = []) => `z.union([${items?.join(', ')}])`,\n const: (value?: string | number | boolean) => `z.literal(${value ?? ''})`,\n /**\n * ISO 8601\n */\n datetime: (offset = false, local = false, version: '3' | '4' = '3', mini?: boolean) => {\n // Zod Mini doesn't support .datetime() method, use plain string\n if (mini) {\n return 'z.string()'\n }\n\n if (offset) {\n return version === '4' ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return version === '4' ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return version === '4' ? 'z.iso.datetime()' : 'z.string().datetime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.date()' : 'z.string().date()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.time()' : 'z.string().time()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n uuid: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.uuid().check(${checks.join(', ')})`\n }\n return 'z.uuid()'\n }\n return [\n coercion ? (version === '4' ? 'z.uuid()' : 'z.coerce.string().uuid()') : version === '4' ? 'z.uuid()' : 'z.string().uuid()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n url: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.url().check(${checks.join(', ')})`\n }\n return 'z.url()'\n }\n return [\n coercion ? (version === '4' ? 'z.url()' : 'z.coerce.string().url()') : version === '4' ? 'z.url()' : 'z.string().url()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n default: (value?: string | number | boolean | object, innerSchema?: string, mini?: boolean) => {\n if (mini && innerSchema) {\n const defaultValue = typeof value === 'object' ? '{}' : (value ?? '')\n return `z._default(${innerSchema}, ${defaultValue})`\n }\n\n if (typeof value === 'object') {\n return '.default({})'\n }\n\n if (value === undefined) {\n return '.default()'\n }\n\n if (typeof value === 'string' && !value) {\n return `.default('')`\n }\n\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = [], mini?: boolean) => {\n // zod/mini doesn't support .and() method, so we can't use intersection types\n // In mini mode, we try to extract and append .check() calls instead\n if (mini && items.length > 0) {\n // Try to extract check calls from additional items\n const checks: string[] = []\n for (const item of items) {\n // Extract .check(...) from patterns like \"z.string().check(...)\"\n // Need to handle nested parentheses properly\n const checkStart = item.indexOf('.check(')\n if (checkStart !== -1) {\n // Find the matching closing parenthesis\n let depth = 0\n let i = checkStart + 7 // length of '.check('\n let checkContent = ''\n while (i < item.length) {\n const char = item[i]\n if (char === '(') depth++\n else if (char === ')') {\n if (depth === 0) break\n depth--\n }\n checkContent += char\n i++\n }\n if (checkContent) {\n checks.push(checkContent)\n }\n }\n }\n\n if (checks.length > 0) {\n // Append checks to the base schema\n return `.check(${checks.join(', ')})`\n }\n\n // If we can't extract checks, just use the first schema (limitation)\n return ''\n }\n return items?.map((item) => `.and(${item})`).join('')\n },\n describe: (value = '', innerSchema?: string, mini?: boolean) => {\n if (mini) {\n return undefined\n }\n\n if (innerSchema) {\n return `z.describe(${innerSchema}, ${value})`\n }\n return `.describe(${value})`\n },\n max: undefined,\n min: undefined,\n optional: (value?: string) => {\n if (value) {\n return `z.optional(${value})`\n }\n return '.optional()'\n },\n matches: (value = '', coercion?: boolean, mini?: boolean, min?: number, max?: number) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n checks.push(`z.regex(${value})`)\n return `z.string().check(${checks.join(', ')})`\n }\n return [\n coercion ? 'z.coerce.string()' : 'z.string()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n `.regex(${value})`,\n ]\n .filter(Boolean)\n .join('')\n },\n email: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.email().check(${checks.join(', ')})`\n }\n return 'z.email()'\n }\n return [\n coercion ? (version === '4' ? 'z.email()' : 'z.coerce.string().email()') : version === '4' ? 'z.email()' : 'z.string().email()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (value?: string) => {\n if (!value) {\n return undefined\n }\n\n return `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string, mini?: boolean) => {\n // Zod Mini doesn't support .catchall() method\n if (mini) {\n return undefined\n }\n return value ? `.catchall(${value})` : undefined\n },\n name: undefined,\n exclusiveMinimum: undefined,\n exclusiveMaximum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nexport function sort(items?: Schema[]): Schema[] {\n const order: string[] = [\n schemaKeywords.string,\n schemaKeywords.datetime,\n schemaKeywords.date,\n schemaKeywords.time,\n schemaKeywords.tuple,\n schemaKeywords.number,\n schemaKeywords.object,\n schemaKeywords.enum,\n schemaKeywords.url,\n schemaKeywords.email,\n schemaKeywords.firstName,\n schemaKeywords.lastName,\n schemaKeywords.password,\n schemaKeywords.matches,\n schemaKeywords.uuid,\n schemaKeywords.null,\n schemaKeywords.min,\n schemaKeywords.max,\n schemaKeywords.default,\n schemaKeywords.describe,\n schemaKeywords.optional,\n schemaKeywords.nullable,\n schemaKeywords.nullish,\n ]\n\n if (!items) {\n return []\n }\n\n return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ['asc'])\n}\n\ntype MiniModifiers = {\n hasOptional?: boolean\n hasNullable?: boolean\n hasNullish?: boolean\n defaultValue?: string | number | true | object\n}\n\n/**\n * Keywords that represent modifiers for mini mode\n * These are separated from the base schema and wrapped around it\n * Note: describe is included to filter it out, but won't be wrapped (Zod Mini doesn't support describe)\n */\nexport const miniModifierKeywords = [schemaKeywords.optional, schemaKeywords.nullable, schemaKeywords.nullish, schemaKeywords.default, schemaKeywords.describe]\n\n/**\n * Extracts mini mode modifiers from a schemas array\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n * Note: describe is not included as Zod Mini doesn't support it\n */\nexport function extractMiniModifiers(schemas: Schema[]): MiniModifiers {\n const defaultSchema = schemas.find((item) => isKeyword(item, schemaKeywords.default)) as { keyword: string; args: unknown } | undefined\n\n return {\n hasOptional: schemas.some((item) => isKeyword(item, schemaKeywords.optional)),\n hasNullable: schemas.some((item) => isKeyword(item, schemaKeywords.nullable)),\n hasNullish: schemas.some((item) => isKeyword(item, schemaKeywords.nullish)),\n defaultValue: defaultSchema?.args as string | number | true | object | undefined,\n }\n}\n\n/**\n * Filters out modifier keywords from schemas for mini mode base schema parsing\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n */\nexport function filterMiniModifiers(schemas: Schema[]): Schema[] {\n return schemas.filter((item) => !miniModifierKeywords.some((keyword) => isKeyword(item, keyword)))\n}\n\n/**\n * Wraps an output string with Zod Mini functional modifiers\n * Order: default (innermost) -> nullable -> optional (outermost)\n * OR: default -> nullish\n * Note: describe is not supported in Zod Mini and is skipped\n */\nexport function wrapWithMiniModifiers(output: string, modifiers: MiniModifiers): string {\n let result = output\n\n // Apply default first (innermost wrapper)\n if (modifiers.defaultValue !== undefined) {\n result = zodKeywordMapper.default(modifiers.defaultValue, result, true)!\n }\n\n // Apply nullish, nullable, or optional (outer wrappers for optionality)\n if (modifiers.hasNullish) {\n result = zodKeywordMapper.nullish(result)!\n } else {\n if (modifiers.hasNullable) {\n result = zodKeywordMapper.nullable(result)!\n }\n if (modifiers.hasOptional) {\n result = zodKeywordMapper.optional(result)!\n }\n }\n\n return result\n}\n\nconst shouldCoerce = (coercion: ParserOptions['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean => {\n if (coercion === undefined) {\n return false\n }\n if (typeof coercion === 'boolean') {\n return coercion\n }\n\n return !!coercion[type]\n}\n\ntype ParserOptions = {\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n version: '3' | '4'\n skipLazyForRefs?: boolean\n mini?: boolean\n}\n\n// Create the parser using createParser\nexport const parse = createParser<string, ParserOptions>({\n mapper: zodKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, parent, name, siblings } = tree\n\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return this.parse({ schema, parent, name, current: current.args[0] as Schema, siblings }, options)\n }\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return zodKeywordMapper.union(\n sort(current.args)\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean),\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n\n const items = sort(current.args)\n .filter((schema: Schema) => {\n return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema.keyword as typeof schemaKeywords.describe)\n })\n .map((it: Schema, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`\n },\n array(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n options.mini,\n )\n },\n enum(tree, options) {\n const { current, schema, name } = tree\n\n if (current.args.asConst) {\n if (current.args.items.length === 1) {\n const child = {\n keyword: schemaKeywords.const,\n args: current.args.items[0],\n }\n return this.parse({ schema, parent: current, name, current: child, siblings: [child] }, options)\n }\n\n return zodKeywordMapper.union(\n current.args.items\n .map((schema) => ({\n keyword: schemaKeywords.const,\n args: schema,\n }))\n .map((it, _index, siblings) => {\n return this.parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n )\n }\n\n return zodKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'boolean') {\n return transformers.stringify(schema.value)\n }\n\n if (schema.format === 'number') {\n return transformers.stringify(schema.value)\n }\n return transformers.stringify(schema.value)\n }),\n )\n },\n ref(tree, options) {\n const { current } = tree\n\n // Skip z.lazy wrapper if skipLazyForRefs is true (e.g., inside v4 getters)\n if (options.skipLazyForRefs) {\n return current.args?.name\n }\n return zodKeywordMapper.ref(current.args?.name)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n\n const propertyEntries = Object.entries(current.args?.properties || {}).filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n\n const properties = propertyEntries\n .map(([propertyName, schemas]) => {\n const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable))\n const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish))\n const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional))\n const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref)\n\n const mappedName = nameSchema?.args || propertyName\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${propertyName}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .filter((schema) => {\n return !isKeyword(schema, schemaKeywords.optional) && !isKeyword(schema, schemaKeywords.nullable) && !isKeyword(schema, schemaKeywords.nullish)\n })\n .map((it) => {\n // For v4 with refs, skip z.lazy wrapper since the getter provides lazy evaluation\n const skipLazyForRefs = options.version === '4' && hasRef\n return this.parse({ schema, parent: current, name, current: it, siblings: schemas }, { ...options, skipLazyForRefs })\n })\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: schema?.properties?.[propertyName] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (options.version === '4' && hasRef) {\n // In mini mode, use functional wrappers instead of chainable methods\n if (options.mini) {\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullish(objectValue)}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.optional(objectValue)}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullable(objectValue)}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // Non-mini mode uses chainable methods\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullish()}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.optional()}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullable()}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // both optional and nullable\n if (isNullish && options.mini) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullish(objectValue)}`\n }\n\n if (isNullish && !options.mini) {\n return `\"${propertyName}\": ${objectValue}${zodKeywordMapper.nullish()}`\n }\n\n // undefined\n if (isOptional) {\n return `\"${propertyName}\": ${zodKeywordMapper.optional(objectValue)}`\n }\n\n // null\n if (isNullable) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullable(objectValue)}`\n }\n\n return `\"${propertyName}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n zodKeywordMapper.object(properties, current.args?.strict, options.version),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n\n return zodKeywordMapper.tuple(\n current.args.items.map((it, _index, siblings) => this.parse({ schema, parent: current, name, current: it, siblings }, options)).filter(Boolean),\n )\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number(current.args.value))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(typeof current.args.value === 'boolean' ? current.args.value : undefined)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n },\n matches(tree, options) {\n const { current, siblings } = tree\n\n // Early exit: if siblings contain both matches and ref → skip matches entirely\n const hasRef = siblings.some((it) => isKeyword(it, schemaKeywords.ref))\n if (hasRef) {\n return undefined // strip matches\n }\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n if (current.args) {\n return zodKeywordMapper.matches(\n transformers.toRegExpString(current.args, null),\n shouldCoerce(options.coercion, 'strings'),\n options.mini,\n minSchema?.args,\n maxSchema?.args,\n )\n }\n return undefined\n },\n default(tree, options) {\n const { current } = tree\n\n // In mini mode, default is handled by wrapWithMiniModifiers\n if (options.mini) {\n return undefined\n }\n if (current.args !== undefined) {\n return zodKeywordMapper.default(current.args)\n }\n // When args is undefined, call the mapper without arguments\n return zodKeywordMapper.default()\n },\n describe(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), undefined, options.mini)\n }\n return undefined\n },\n string(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'), minSchema?.args, maxSchema?.args, options.mini)\n },\n uuid(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n email(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n url(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n },\n number(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.number(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n integer(tree, options) {\n const { siblings } = tree\n\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n const exclusiveMinimumSchema = findSchemaKeyword(siblings, 'exclusiveMinimum')\n const exclusiveMaximumSchema = findSchemaKeyword(siblings, 'exclusiveMaximum')\n\n return zodKeywordMapper.integer(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n options.version,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n },\n datetime(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini)\n },\n date(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n time(tree, options) {\n const { current } = tree\n\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n schema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n version: '3' | '4'\n emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType']\n mini?: boolean\n}\n\nexport function Zod({\n name,\n typeName,\n tree,\n schema,\n inferTypeName,\n mapper,\n coercion,\n keysToOmit,\n description,\n wrapOutput,\n version,\n emptySchemaType,\n mini = false,\n}: Props): KubbNode {\n const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple)\n\n const schemas = parserZod.sort(tree).filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n\n // In mini mode, filter out modifiers from the main schema parsing\n const baseSchemas = mini ? parserZod.filterMiniModifiers(schemas) : schemas\n\n const output = baseSchemas\n .map((schemaKeyword, index) => {\n const siblings = baseSchemas.filter((_, i) => i !== index)\n\n return parserZod.parse({ schema, parent: undefined, current: schemaKeyword, siblings, name }, { mapper, coercion, wrapOutput, version, mini })\n })\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n const firstSchema = schemas.at(0)\n const lastSchema = schemas.at(-1)\n\n if (!mini && lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap().unwrap()'\n }\n } else {\n suffix = '.unwrap()'\n }\n } else if (!mini) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.schema'\n } else {\n suffix = '.unwrap()'\n }\n }\n }\n\n const emptyValue = parserZod.parse(\n {\n schema,\n parent: undefined,\n current: {\n keyword: schemaKeywords[emptySchemaType],\n },\n siblings: [],\n },\n { mapper, coercion, wrapOutput, version, mini },\n )\n\n let baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n emptyValue ||\n ''\n\n // For mini mode, wrap the output with modifiers using the parser function\n if (mini) {\n baseSchemaOutput = parserZod.wrapWithMiniModifiers(baseSchemaOutput, parserZod.extractMiniModifiers(schemas))\n }\n\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ${version === '4' ? 'z.ZodType' : 'ToZod'}<${typeName}>` : wrappedSchemaOutput\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const\n export\n name={name}\n JSDoc={{\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }}\n >\n {finalOutput}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n {typeName && (\n <Type export name={inferTypeName}>\n {typeName}\n </Type>\n )}\n {!typeName && (\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n )}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;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E,8CACE,oBAAC,KAAK;EAAa;EAAM;EAAa;YACpC,oBAAC;GACC;GACM;GACN,OAAO,EACL,UAAU,CAAC,cAAc,gBAAgB,aAAa,eAAe,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ,EACjH;aAEA;IACK;GACI,EACb,iBACC,qBAAC,KAAK;EAAO,MAAM;EAAe;EAAa;EAAY;aACxD,YACC,oBAAC;GAAK;GAAO,MAAM;aAChB;IACI,EAER,CAAC,YACA,oBAAC;GAAK;GAAO,MAAM;aAChB,kBAAkB,KAAK;IACnB;GAEG,IAEf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-C9G6FSvb.cjs","names":["File","Operations","SchemaGenerator","options","schemaKeywords","pluginTsName","Fragment","File","path","Zod"],"sources":["../src/generators/operationsGenerator.tsx","../src/generators/zodGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations.tsx'\nimport type { PluginZod } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginZod>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const {\n key: pluginKey,\n options: { output, importPath },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getFile, groupSchemasByName } = useOperationManager(generator)\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n const transformedOperations = operations.map((operation) => ({ operation, data: groupSchemasByName(operation, { type: 'function' }) }))\n\n const imports = Object.entries(transformedOperations)\n .map(([key, { data, operation }]) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean)\n\n return <File.Import key={key} name={names} root={file.path} path={getFile(operation).path} />\n })\n .filter(Boolean)\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import isTypeOnly name={['z']} path={importPath} />\n {imports}\n <Operations name={name} operations={transformedOperations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, Fragment } from '@kubb/react-fabric'\nimport { Zod } from '../components'\nimport type { PluginZod } from '../types'\n\nexport const zodGenerator = createReactGenerator<PluginZod>({\n name: 'zod',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version, mini },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n plugin,\n pluginManager,\n events: generator.context.events,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }: OperationSchemaType) => {\n let schemaObject = schemaOriginal\n let keysToOmit = keysToOmitOriginal\n\n if ((schemaOriginal.anyOf || schemaOriginal.oneOf) && keysToOmitOriginal && keysToOmitOriginal.length > 0) {\n schemaObject = structuredClone(schemaOriginal)\n\n // Remove $ref so the schema parser generates inline schema instead of a reference\n delete schemaObject.$ref\n\n for (const key of keysToOmitOriginal) {\n delete schemaObject.properties?.[key]\n }\n\n if (Array.isArray(schemaObject.required)) {\n schemaObject.required = schemaObject.required.filter((key) => !keysToOmitOriginal.includes(key))\n }\n\n keysToOmit = undefined\n }\n\n const hasProperties = Object.keys(schemaObject || {}).length > 0\n const hasDefaults = Object.values(schemaObject.properties || {}).some((prop) => prop && Object.hasOwn(prop, 'default'))\n\n const required = Array.isArray(schemaObject?.required) ? schemaObject.required.length > 0 : !!schemaObject?.required\n const optional = !required && !hasDefaults && hasProperties && name.includes('Params')\n\n if (!optional && Array.isArray(schemaObject.required) && !schemaObject.required.length) {\n schemaObject.required = Object.entries(schemaObject.properties || {})\n .filter(([_key, value]) => value && Object.hasOwn(value, 'default'))\n .map(([key]) => key)\n }\n\n const tree = [\n ...schemaGenerator.parse({ schema: schemaObject, name, parentName: null }),\n optional ? { keyword: schemaKeywords.optional } : undefined,\n ].filter(Boolean)\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const coercion = name.includes('Params') ? { numbers: true, strings: false, dates: true } : globalCoercion\n\n const zod = {\n name: schemaManager.getName(name, { type: 'function' }),\n inferTypeName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, {\n type: 'type',\n pluginKey: [pluginTsName],\n }),\n file: schemaManager.getFile(options.operationName || name, {\n pluginKey: [pluginTsName],\n group,\n }),\n }\n\n return (\n <Fragment>\n {typed && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && <File.Import name={['ToZod']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n coercion={coercion}\n keysToOmit={keysToOmit}\n wrapOutput={wrapOutput}\n version={plugin.options.version}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </Fragment>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['z']} path={plugin.options.importPath} />\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile, getImports } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, mini },\n } = plugin\n const pluginManager = usePluginManager()\n const oas = useOas()\n\n const imports = getImports(schema.tree)\n\n const zod = {\n name: getName(schema.name, { type: 'function' }),\n inferTypeName: getName(schema.name, { type: 'type' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginKey: [pluginTsName] }),\n file: getFile(schema.name, { pluginKey: [pluginTsName] }),\n }\n\n return (\n <File\n baseName={zod.file.baseName}\n path={zod.file.path}\n meta={zod.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['z']} path={importPath} />\n {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && (\n <File.Import name={['ToZod']} root={zod.file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />\n )}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={zod.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n coercion={coercion}\n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,CAACF,6BAAa;IAAE,CAAC;GACvE,MAAM,QAAQ,OAAO,MAAM,EAAE,WAAW,CAACA,6BAAa,EAAE,CAAC;GAC1D;AAED,SACE,yDAACE;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,8CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,8CAAkB;IAAE;IAAK;IAAQ,CAAC;;IAElC,wDAACA,wBAAK;KAAO,MAAM,CAAC,IAAI;KAAE,MAAM;MAAc;IAC7C,SAAS,wDAACA,wBAAK;KAAO;KAAW,MAAM,IAAI,KAAK;KAAM,MAAM,KAAK,KAAK;KAAM,MAAM,CAAC,KAAK,KAAK;MAAI;IACjG,SAAS,YAAY,OACpB,wDAACA,wBAAK;KAAO,MAAM,CAAC,QAAQ;KAAE,MAAM,IAAI,KAAK;KAAM,MAAMC,kBAAK,QAAQ,OAAO,MAAM,OAAO,OAAO,MAAM,iBAAiB;MAAI;IAE7H,QAAQ,KAAK,QACZ,wDAACD,wBAAK;KAA4D,MAAM,IAAI,KAAK;KAAM,MAAM,IAAI;KAAM,MAAM,IAAI;OAA/F;KAAC,IAAI;KAAM,IAAI;KAAM,IAAI;KAAW,CAAC,KAAK,IAAI,CAAyD,CACzH;IAEF,wDAACE;KACC,MAAM,IAAI;KACV,UAAU,QAAQ,KAAK,OAAO;KAC9B,eAAe,WAAW,IAAI,gBAAgB;KAC9C,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACb,QAAQ,OAAO;KACP;KACE;KACE;KACH;KACQ;KACX;MACN;;IACG;;CAGZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-D6WbQJ7U.js","names":["options"],"sources":["../src/generators/operationsGenerator.tsx","../src/generators/zodGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations.tsx'\nimport type { PluginZod } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginZod>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const {\n key: pluginKey,\n options: { output, importPath },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getFile, groupSchemasByName } = useOperationManager(generator)\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n const transformedOperations = operations.map((operation) => ({ operation, data: groupSchemasByName(operation, { type: 'function' }) }))\n\n const imports = Object.entries(transformedOperations)\n .map(([key, { data, operation }]) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean)\n\n return <File.Import key={key} name={names} root={file.path} path={getFile(operation).path} />\n })\n .filter(Boolean)\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import isTypeOnly name={['z']} path={importPath} />\n {imports}\n <Operations name={name} operations={transformedOperations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, Fragment } from '@kubb/react-fabric'\nimport { Zod } from '../components'\nimport type { PluginZod } from '../types'\n\nexport const zodGenerator = createReactGenerator<PluginZod>({\n name: 'zod',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version, mini },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n plugin,\n pluginManager,\n events: generator.context.events,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }: OperationSchemaType) => {\n let schemaObject = schemaOriginal\n let keysToOmit = keysToOmitOriginal\n\n if ((schemaOriginal.anyOf || schemaOriginal.oneOf) && keysToOmitOriginal && keysToOmitOriginal.length > 0) {\n schemaObject = structuredClone(schemaOriginal)\n\n // Remove $ref so the schema parser generates inline schema instead of a reference\n delete schemaObject.$ref\n\n for (const key of keysToOmitOriginal) {\n delete schemaObject.properties?.[key]\n }\n\n if (Array.isArray(schemaObject.required)) {\n schemaObject.required = schemaObject.required.filter((key) => !keysToOmitOriginal.includes(key))\n }\n\n keysToOmit = undefined\n }\n\n const hasProperties = Object.keys(schemaObject || {}).length > 0\n const hasDefaults = Object.values(schemaObject.properties || {}).some((prop) => prop && Object.hasOwn(prop, 'default'))\n\n const required = Array.isArray(schemaObject?.required) ? schemaObject.required.length > 0 : !!schemaObject?.required\n const optional = !required && !hasDefaults && hasProperties && name.includes('Params')\n\n if (!optional && Array.isArray(schemaObject.required) && !schemaObject.required.length) {\n schemaObject.required = Object.entries(schemaObject.properties || {})\n .filter(([_key, value]) => value && Object.hasOwn(value, 'default'))\n .map(([key]) => key)\n }\n\n const tree = [\n ...schemaGenerator.parse({ schema: schemaObject, name, parentName: null }),\n optional ? { keyword: schemaKeywords.optional } : undefined,\n ].filter(Boolean)\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const coercion = name.includes('Params') ? { numbers: true, strings: false, dates: true } : globalCoercion\n\n const zod = {\n name: schemaManager.getName(name, { type: 'function' }),\n inferTypeName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, {\n type: 'type',\n pluginKey: [pluginTsName],\n }),\n file: schemaManager.getFile(options.operationName || name, {\n pluginKey: [pluginTsName],\n group,\n }),\n }\n\n return (\n <Fragment>\n {typed && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && <File.Import name={['ToZod']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n coercion={coercion}\n keysToOmit={keysToOmit}\n wrapOutput={wrapOutput}\n version={plugin.options.version}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </Fragment>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['z']} path={plugin.options.importPath} />\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile, getImports } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, mini },\n } = plugin\n const pluginManager = usePluginManager()\n const oas = useOas()\n\n const imports = getImports(schema.tree)\n\n const zod = {\n name: getName(schema.name, { type: 'function' }),\n inferTypeName: getName(schema.name, { type: 'type' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginKey: [pluginTsName] }),\n file: getFile(schema.name, { pluginKey: [pluginTsName] }),\n }\n\n return (\n <File\n baseName={zod.file.baseName}\n path={zod.file.path}\n meta={zod.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['z']} path={importPath} />\n {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && (\n <File.Import name={['ToZod']} root={zod.file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />\n )}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={zod.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Zod\n name={zod.name}\n typeName={typed ? type.name : undefined}\n inferTypeName={inferred ? zod.inferTypeName : undefined}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n coercion={coercion}\n wrapOutput={wrapOutput}\n version={version}\n emptySchemaType={emptySchemaType}\n mini={mini}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAa,sBAAsB,qBAAgC;CACjE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,UAAU;EAC5C,MAAM,EACJ,KAAK,WACL,SAAS,EAAE,QAAQ,iBACjB;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,SAAS,uBAAuB,oBAAoB,UAAU;EAEtE,MAAM,OAAO;EACb,MAAM,OAAO,cAAc,QAAQ;GAAE;GAAM,SAAS;GAAO;GAAW,CAAC;EAEvE,MAAM,wBAAwB,WAAW,KAAK,eAAe;GAAE;GAAW,MAAM,mBAAmB,WAAW,EAAE,MAAM,YAAY,CAAC;GAAE,EAAE;EAEvI,MAAM,UAAU,OAAO,QAAQ,sBAAsB,CAClD,KAAK,CAAC,KAAK,EAAE,MAAM,iBAAiB;GAC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