@kubb/plugin-zod 4.32.3 → 4.33.0

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.
@@ -99,6 +99,7 @@ const zodGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
99
99
  schemas.request,
100
100
  schemas.response
101
101
  ].flat().filter(Boolean);
102
+ const toZodPath = node_path.default.resolve(config.root, config.output.path, ".kubb/ToZod.ts");
102
103
  const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }) => {
103
104
  let schemaObject = schemaOriginal;
104
105
  let keysToOmit = keysToOmitOriginal;
@@ -147,12 +148,6 @@ const zodGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
147
148
  path: type.file.path,
148
149
  name: [type.name]
149
150
  }),
150
- typed && version === "3" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
151
- name: ["ToZod"],
152
- isTypeOnly: true,
153
- root: file.path,
154
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/ToZod.ts")
155
- }),
156
151
  imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
157
152
  root: file.path,
158
153
  path: imp.path,
@@ -194,11 +189,20 @@ const zodGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
194
189
  oas,
195
190
  output: plugin.options.output
196
191
  }),
197
- children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
198
- name: isZodImport ? "z" : ["z"],
199
- path: plugin.options.importPath,
200
- isNameSpace: isZodImport
201
- }), operationSchemas.map(mapOperationSchema)]
192
+ children: [
193
+ /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
194
+ name: isZodImport ? "z" : ["z"],
195
+ path: plugin.options.importPath,
196
+ isNameSpace: isZodImport
197
+ }),
198
+ typed && version === "3" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
199
+ name: ["ToZod"],
200
+ isTypeOnly: true,
201
+ root: file.path,
202
+ path: toZodPath
203
+ }),
204
+ operationSchemas.map(mapOperationSchema)
205
+ ]
202
206
  });
203
207
  },
204
208
  Schema({ config, schema, plugin }) {
@@ -220,6 +224,7 @@ const zodGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
220
224
  file: getFile(schema.name, { pluginKey: [_kubb_plugin_ts.pluginTsName] })
221
225
  };
222
226
  const isZodImport = importPath === "zod" || importPath === "zod/mini";
227
+ const toZodPath = node_path.default.resolve(config.root, config.output.path, ".kubb/ToZod.ts");
223
228
  return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
224
229
  baseName: zod.file.baseName,
225
230
  path: zod.file.path,
@@ -247,8 +252,9 @@ const zodGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
247
252
  }),
248
253
  typed && version === "3" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
249
254
  name: ["ToZod"],
255
+ isTypeOnly: true,
250
256
  root: zod.file.path,
251
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/ToZod.ts")
257
+ path: toZodPath
252
258
  }),
253
259
  imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
254
260
  root: zod.file.path,
@@ -292,4 +298,4 @@ Object.defineProperty(exports, "zodGenerator", {
292
298
  }
293
299
  });
294
300
 
295
- //# sourceMappingURL=generators-Q_WrTrfv.cjs.map
301
+ //# sourceMappingURL=generators-DEsJkwyB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-DEsJkwyB.cjs","names":["File","Operations","SchemaGenerator","path","schemaKeywords","pluginTsName","File","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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\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, getImports } 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, guidType, 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 const toZodPath = path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')\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 = 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 {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 guidType={guidType}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </>\n )\n }\n\n const isZodImport = plugin.options.importPath === 'zod' || plugin.options.importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={plugin.options.importPath} isNameSpace={isZodImport} />\n {typed && version === '3' && <File.Import name={['ToZod']} isTypeOnly root={file.path} path={toZodPath} />}\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, guidType, 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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\n const toZodPath = path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && <File.Import name={['ToZod']} isTypeOnly root={zod.file.path} path={toZodPath} />}\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 guidType={guidType}\n emptySchemaType={emptySchemaType}\n mini={mini}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,uBAAA,GAAA,4BAAA,sBAAsD;CACjE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,UAAU;EAC5C,MAAM,EACJ,KAAK,WACL,S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AK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,SAAA,GAAA,uBAAA,WAAkB;IAAE;IAAK;IAAQ,CAAC;aALpC;IAOE,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;KAAa,MAAM,cAAc,MAAM,CAAC,IAAI;KAAE,MAAM;KAAY,aAAa;KAAe,CAAA;IAC3F,SAAS,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;KAAa,YAAA;KAAW,MAAM,IAAI,KAAK;KAAM,MAAM,KAAK,KAAK;KAAM,MAAM,CAAC,KAAK,KAAK;KAAI,CAAA;IACjG,SAAS,YAAY,OAAO,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;KAAa,MAAM,CAAC,QAAQ;KAAE,YAAA;KAAW,MAAM,IAAI,KAAK;KAAM,MAAM;KAAa,CAAA;IAC7G,QAAQ,KAAK,QACZ,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;KAAkE,MAAM,IAAI,KAAK;KAAM,MAAM,IAAI;KAAM,MAAM,IAAI;KAAQ,EAAvG;KAAC,IAAI;KAAM,IAAI;KAAM,IAAI;KAAW,CAAC,KAAK,IAAI,CAAyD,CACzH;IAEF,iBAAA,GAAA,+BAAA,KAACC,mBAAAA,KAAD;KACE,MAAM,IAAI;KACV,UAAU,QAAQ,KAAK,OAAO,KAAA;KAC9B,eAAe,WAAW,IAAI,gBAAgB,KAAA;KAC9C,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACb,QAAQ,OAAO;KACP;KACE;KACE;KACH;KACC;KACO;KACX;KACN,CAAA;IACG;;;CAGZ,CAAC"}
@@ -99,6 +99,7 @@ const zodGenerator = createReactGenerator({
99
99
  schemas.request,
100
100
  schemas.response
101
101
  ].flat().filter(Boolean);
102
+ const toZodPath = path.resolve(config.root, config.output.path, ".kubb/ToZod.ts");
102
103
  const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }) => {
103
104
  let schemaObject = schemaOriginal;
104
105
  let keysToOmit = keysToOmitOriginal;
@@ -147,12 +148,6 @@ const zodGenerator = createReactGenerator({
147
148
  path: type.file.path,
148
149
  name: [type.name]
149
150
  }),
150
- typed && version === "3" && /* @__PURE__ */ jsx(File.Import, {
151
- name: ["ToZod"],
152
- isTypeOnly: true,
153
- root: file.path,
154
- path: path.resolve(config.root, config.output.path, ".kubb/ToZod.ts")
155
- }),
156
151
  imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
157
152
  root: file.path,
158
153
  path: imp.path,
@@ -194,11 +189,20 @@ const zodGenerator = createReactGenerator({
194
189
  oas,
195
190
  output: plugin.options.output
196
191
  }),
197
- children: [/* @__PURE__ */ jsx(File.Import, {
198
- name: isZodImport ? "z" : ["z"],
199
- path: plugin.options.importPath,
200
- isNameSpace: isZodImport
201
- }), operationSchemas.map(mapOperationSchema)]
192
+ children: [
193
+ /* @__PURE__ */ jsx(File.Import, {
194
+ name: isZodImport ? "z" : ["z"],
195
+ path: plugin.options.importPath,
196
+ isNameSpace: isZodImport
197
+ }),
198
+ typed && version === "3" && /* @__PURE__ */ jsx(File.Import, {
199
+ name: ["ToZod"],
200
+ isTypeOnly: true,
201
+ root: file.path,
202
+ path: toZodPath
203
+ }),
204
+ operationSchemas.map(mapOperationSchema)
205
+ ]
202
206
  });
203
207
  },
204
208
  Schema({ config, schema, plugin }) {
@@ -220,6 +224,7 @@ const zodGenerator = createReactGenerator({
220
224
  file: getFile(schema.name, { pluginKey: [pluginTsName] })
221
225
  };
222
226
  const isZodImport = importPath === "zod" || importPath === "zod/mini";
227
+ const toZodPath = path.resolve(config.root, config.output.path, ".kubb/ToZod.ts");
223
228
  return /* @__PURE__ */ jsxs(File, {
224
229
  baseName: zod.file.baseName,
225
230
  path: zod.file.path,
@@ -247,8 +252,9 @@ const zodGenerator = createReactGenerator({
247
252
  }),
248
253
  typed && version === "3" && /* @__PURE__ */ jsx(File.Import, {
249
254
  name: ["ToZod"],
255
+ isTypeOnly: true,
250
256
  root: zod.file.path,
251
- path: path.resolve(config.root, config.output.path, ".kubb/ToZod.ts")
257
+ path: toZodPath
252
258
  }),
253
259
  imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
254
260
  root: zod.file.path,
@@ -281,4 +287,4 @@ const zodGenerator = createReactGenerator({
281
287
  //#endregion
282
288
  export { operationsGenerator as n, zodGenerator as t };
283
289
 
284
- //# sourceMappingURL=generators-HVqNlkDw.js.map
290
+ //# sourceMappingURL=generators-DfvfkbX5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-DfvfkbX5.js","names":[],"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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\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, getImports } 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, guidType, 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 const toZodPath = path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')\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 = 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 {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 guidType={guidType}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </>\n )\n }\n\n const isZodImport = plugin.options.importPath === 'zod' || plugin.options.importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={plugin.options.importPath} isNameSpace={isZodImport} />\n {typed && version === '3' && <File.Import name={['ToZod']} isTypeOnly root={file.path} path={toZodPath} />}\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, guidType, 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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\n const toZodPath = path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}\n {typed && version === '3' && <File.Import name={['ToZod']} isTypeOnly root={zod.file.path} path={toZodPath} />}\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 guidType={guidType}\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;GACnC,MAAM,QAAQ;IAAC,KAAK;IAAS,GAAG,OAAO,OAAO,KAAK,UAAU;IAAE,GAAG,OAAO,OAAO,KAAK,WAAW;IAAC,CAAC,OAAO,QAAQ;AAEjH,UAAO,oBAAC,KAAK,QAAN;IAAuB,MAAM;IAAO,MAAM,KAAK;IAAM,MAAM,QAAQ,UAAU,CAAC;IAAQ,EAApE,IAAoE;IAC7F,CACD,OAAO,QAAQ;EAElB,MAAM,cAAc,eAAe,SAAS,eAAe;AAE3D,SACE,qBAAC,MAAD;GACE,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAA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IAAI,KAAK;KAAM,MAAM,KAAK,KAAK;KAAM,MAAM,CAAC,KAAK,KAAK;KAAI,CAAA;IACjG,SAAS,YAAY,OAAO,oBAAC,KAAK,QAAN;KAAa,MAAM,CAAC,QAAQ;KAAE,YAAA;KAAW,MAAM,IAAI,KAAK;KAAM,MAAM;KAAa,CAAA;IAC7G,QAAQ,KAAK,QACZ,oBAAC,KAAK,QAAN;KAAkE,MAAM,IAAI,KAAK;KAAM,MAAM,IAAI;KAAM,MAAM,IAAI;KAAQ,EAAvG;KAAC,IAAI;KAAM,IAAI;KAAM,IAAI;KAAW,CAAC,KAAK,IAAI,CAAyD,CACzH;IAEF,oBAAC,KAAD;KACE,MAAM,IAAI;KACV,UAAU,QAAQ,KAAK,OAAO,KAAA;KAC9B,eAAe,WAAW,IAAI,gBAAgB,KAAA;KAC9C,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACb,QAAQ,OAAO;KACP;KACE;KACE;KACH;KACC;KACO;KACX;KACN,CAAA;IACG;;;CAGZ,CAAC"}
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generators = require("./generators-Q_WrTrfv.cjs");
2
+ const require_generators = require("./generators-DEsJkwyB.cjs");
3
3
  exports.operationsGenerator = require_generators.operationsGenerator;
4
4
  exports.zodGenerator = require_generators.zodGenerator;
@@ -1,2 +1,2 @@
1
- import { n as operationsGenerator, t as zodGenerator } from "./generators-HVqNlkDw.js";
1
+ import { n as operationsGenerator, t as zodGenerator } from "./generators-DfvfkbX5.js";
2
2
  export { operationsGenerator, zodGenerator };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_components = require("./components-C-rV8Ij4.cjs");
3
- const require_generators = require("./generators-Q_WrTrfv.cjs");
3
+ const require_generators = require("./generators-DEsJkwyB.cjs");
4
4
  const require_templates_ToZod_source = require("./templates/ToZod.source.cjs");
5
5
  let node_path = require("node:path");
6
6
  node_path = require_components.__toESM(node_path);
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { n as operationsGenerator, t as zodGenerator } from "./generators-HVqNlkDw.js";
2
+ import { n as operationsGenerator, t as zodGenerator } from "./generators-DfvfkbX5.js";
3
3
  import { source } from "./templates/ToZod.source.js";
4
4
  import path from "node:path";
5
5
  import { PackageManager, definePlugin, getBarrelFiles, getMode } from "@kubb/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-zod",
3
- "version": "4.32.3",
3
+ "version": "4.33.0",
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",
@@ -79,10 +79,10 @@
79
79
  "dependencies": {
80
80
  "@kubb/react-fabric": "0.13.3",
81
81
  "remeda": "^2.33.6",
82
- "@kubb/core": "4.32.3",
83
- "@kubb/plugin-oas": "4.32.3",
84
- "@kubb/oas": "4.32.3",
85
- "@kubb/plugin-ts": "4.32.3"
82
+ "@kubb/core": "4.33.0",
83
+ "@kubb/plugin-oas": "4.33.0",
84
+ "@kubb/oas": "4.33.0",
85
+ "@kubb/plugin-ts": "4.33.0"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@asteasolutions/zod-to-openapi": "^8.4.3",
@@ -39,6 +39,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
39
39
  const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]
40
40
  .flat()
41
41
  .filter(Boolean)
42
+ const toZodPath = path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')
42
43
 
43
44
  const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }: OperationSchemaType) => {
44
45
  let schemaObject = schemaOriginal
@@ -102,9 +103,6 @@ export const zodGenerator = createReactGenerator<PluginZod>({
102
103
  return (
103
104
  <>
104
105
  {typed && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}
105
- {typed && version === '3' && (
106
- <File.Import name={['ToZod']} isTypeOnly root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />
107
- )}
108
106
  {imports.map((imp) => (
109
107
  <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />
110
108
  ))}
@@ -139,6 +137,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
139
137
  footer={getFooter({ oas, output: plugin.options.output })}
140
138
  >
141
139
  <File.Import name={isZodImport ? 'z' : ['z']} path={plugin.options.importPath} isNameSpace={isZodImport} />
140
+ {typed && version === '3' && <File.Import name={['ToZod']} isTypeOnly root={file.path} path={toZodPath} />}
142
141
  {operationSchemas.map(mapOperationSchema)}
143
142
  </File>
144
143
  )
@@ -165,6 +164,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
165
164
  }
166
165
 
167
166
  const isZodImport = importPath === 'zod' || importPath === 'zod/mini'
167
+ const toZodPath = path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')
168
168
 
169
169
  return (
170
170
  <File
@@ -176,9 +176,7 @@ export const zodGenerator = createReactGenerator<PluginZod>({
176
176
  >
177
177
  <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />
178
178
  {typed && <File.Import isTypeOnly root={zod.file.path} path={type.file.path} name={[type.name]} />}
179
- {typed && version === '3' && (
180
- <File.Import name={['ToZod']} root={zod.file.path} path={path.resolve(config.root, config.output.path, '.kubb/ToZod.ts')} />
181
- )}
179
+ {typed && version === '3' && <File.Import name={['ToZod']} isTypeOnly root={zod.file.path} path={toZodPath} />}
182
180
  {imports.map((imp) => (
183
181
  <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={zod.file.path} path={imp.path} name={imp.name} />
184
182
  ))}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generators-HVqNlkDw.js","names":[],"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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\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, getImports } 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, guidType, 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 = 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' && (\n <File.Import name={['ToZod']} isTypeOnly root={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={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 guidType={guidType}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </>\n )\n }\n\n const isZodImport = plugin.options.importPath === 'zod' || plugin.options.importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={plugin.options.importPath} isNameSpace={isZodImport} />\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, guidType, 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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\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 guidType={guidType}\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,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Q,KAAK,OAAO,KAAA;KAC9B,eAAe,WAAW,IAAI,gBAAgB,KAAA;KAC9C,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACb,QAAQ,OAAO;KACP;KACE;KACE;KACH;KACC;KACO;KACX;KACN,CAAA;IACG;;;CAGZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generators-Q_WrTrfv.cjs","names":["File","Operations","SchemaGenerator","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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\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, getImports } 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, guidType, 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 = 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' && (\n <File.Import name={['ToZod']} isTypeOnly root={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={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 guidType={guidType}\n emptySchemaType={plugin.options.emptySchemaType}\n mini={mini}\n />\n </>\n )\n }\n\n const isZodImport = plugin.options.importPath === 'zod' || plugin.options.importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={plugin.options.importPath} isNameSpace={isZodImport} />\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ config, schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, guidType, 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 const isZodImport = importPath === 'zod' || importPath === 'zod/mini'\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={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\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 guidType={guidType}\n emptySchemaType={emptySchemaType}\n mini={mini}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,uBAAA,GAAA,4BAAA,sBAAsD;CACjE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,UAAU;EAC5C,MAAM,EACJ,KAAK,WACL,SAAS,EAAE,QAAQ,iBACjB;EACJ,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;EAExC,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,SAAS,wBAAA,GAAA,uBAAA,qBAA2C,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;GACnC,MAAM,QAAQ;IAAC,KAAK;IAAS,GAAG,OAAO,OAAO,KAAK,UAAU;IAAE,GAAG,OAAO,OAAO,KAAK,WAAW;IAAC,CAAC,OAAO,QAAQ;AAEjH,UAAO,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;IAAuB,MAAM;IAAO,MAAM,KAAK;IAAM,MAAM,QAAQ,UAAU,CAAC;IAAQ,EAApE,IAAoE;IAC7F,CACD,OAAO,QAAQ;EAElB,MAAM,cAAc,eAAe,SAAS,eAAe;AAE3D,SACE,iBAAA,GAAA,+BAAA,MAACA,mBAAAA,MAAD;GACE,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,SAAA,GAAA,uBAAA,WAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ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