@kubb/plugin-zod 3.8.0 → 3.9.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.
- package/dist/{chunk-DKAOGAVN.cjs → chunk-HQATWJUR.cjs} +50 -18
- package/dist/chunk-HQATWJUR.cjs.map +1 -0
- package/dist/{chunk-VPOWWZEW.js → chunk-PQF3NNR6.js} +51 -19
- package/dist/chunk-PQF3NNR6.js.map +1 -0
- package/dist/{chunk-BWBRIHPY.cjs → chunk-RUWAB6W7.cjs} +50 -29
- package/dist/chunk-RUWAB6W7.cjs.map +1 -0
- package/dist/{chunk-2JCBW3TA.js → chunk-SUZSCH4B.js} +49 -28
- package/dist/chunk-SUZSCH4B.js.map +1 -0
- package/dist/components.cjs +3 -3
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.js +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/package.json +10 -10
- package/src/generators/__snapshots__/anyof.ts +4 -0
- package/src/generators/__snapshots__/coercion.ts +4 -0
- package/src/generators/__snapshots__/coercionDates.ts +4 -0
- package/src/generators/__snapshots__/coercionNumbers.ts +4 -0
- package/src/generators/__snapshots__/coercionStrings.ts +4 -0
- package/src/generators/__snapshots__/createPet.ts +4 -0
- package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +4 -0
- package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown_wrapOutput.ts +4 -0
- package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown_wrapOutput_entire_.ts +4 -0
- package/src/generators/__snapshots__/createPet_wrapOutput.ts +4 -0
- package/src/generators/__snapshots__/deletePet.ts +4 -0
- package/src/generators/__snapshots__/deletePet_wrapOutput.ts +4 -0
- package/src/generators/__snapshots__/discriminator.ts +4 -0
- package/src/generators/__snapshots__/enumBooleanLiteral.ts +4 -0
- package/src/generators/__snapshots__/enumNamesType.ts +4 -0
- package/src/generators/__snapshots__/enumNullable.ts +4 -0
- package/src/generators/__snapshots__/enumSingleLiteral.ts +4 -0
- package/src/generators/__snapshots__/enumVarNamesType.ts +4 -0
- package/src/generators/__snapshots__/example.ts +4 -0
- package/src/generators/__snapshots__/getPets.ts +4 -0
- package/src/generators/__snapshots__/getPets_wrapOutput.ts +4 -0
- package/src/generators/__snapshots__/mixedValueTypeConst.ts +4 -0
- package/src/generators/__snapshots__/nullableString.ts +4 -0
- package/src/generators/__snapshots__/nullableStringUuid.ts +4 -0
- package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +4 -0
- package/src/generators/__snapshots__/numberValueConst.ts +4 -0
- package/src/generators/__snapshots__/oneof.ts +4 -0
- package/src/generators/__snapshots__/operations.ts +4 -0
- package/src/generators/__snapshots__/optionalPetInfer.ts +4 -0
- package/src/generators/__snapshots__/optionalPetTyped.ts +4 -0
- package/src/generators/__snapshots__/order.ts +4 -0
- package/src/generators/__snapshots__/orderDateTypeFalse.ts +4 -0
- package/src/generators/__snapshots__/orderDateTypeString.ts +4 -0
- package/src/generators/__snapshots__/pet.ts +4 -0
- package/src/generators/__snapshots__/petArray.ts +4 -0
- package/src/generators/__snapshots__/petCoercion.ts +4 -0
- package/src/generators/__snapshots__/petTupleObject.ts +4 -0
- package/src/generators/__snapshots__/petWithMapper.ts +4 -0
- package/src/generators/__snapshots__/pets.ts +4 -0
- package/src/generators/__snapshots__/recursive.ts +4 -0
- package/src/generators/__snapshots__/showPetById.ts +4 -0
- package/src/generators/__snapshots__/showPetById_wrapOutput.ts +4 -0
- package/src/generators/__snapshots__/stringValueConst.ts +4 -0
- package/src/generators/__snapshots__/toy.ts +4 -0
- package/src/generators/__snapshots__/uuidSchema.ts +4 -0
- package/src/generators/operationsGenerator.tsx +7 -1
- package/src/generators/zodGenerator.tsx +9 -2
- package/src/parser.ts +61 -20
- package/dist/chunk-2JCBW3TA.js.map +0 -1
- package/dist/chunk-BWBRIHPY.cjs.map +0 -1
- package/dist/chunk-DKAOGAVN.cjs.map +0 -1
- package/dist/chunk-VPOWWZEW.js.map +0 -1
|
@@ -4,6 +4,7 @@ var react = require('@kubb/react');
|
|
|
4
4
|
var transformers2 = require('@kubb/core/transformers');
|
|
5
5
|
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
6
6
|
var pluginOas = require('@kubb/plugin-oas');
|
|
7
|
+
var core = require('@kubb/core');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
@@ -33,6 +34,8 @@ function Operations({ name, operations }) {
|
|
|
33
34
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: "paths", isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Const, { export: true, name: "paths", asConst: true, children: `{${transformers2__default.default.stringifyObject(pathsJSON)}}` }) })
|
|
34
35
|
] });
|
|
35
36
|
}
|
|
37
|
+
var packageManager = new core.PackageManager();
|
|
38
|
+
var isV4 = () => packageManager.isValidSync("zod", ">=4") || packageManager.isValidSync("zod", "next");
|
|
36
39
|
var zodKeywordMapper = {
|
|
37
40
|
any: () => "z.any()",
|
|
38
41
|
unknown: () => "z.unknown()",
|
|
@@ -42,12 +45,32 @@ var zodKeywordMapper = {
|
|
|
42
45
|
},
|
|
43
46
|
integer: (coercion, min, max) => {
|
|
44
47
|
return [
|
|
45
|
-
coercion ? "z.coerce.number().int()" : "z.number().int()",
|
|
48
|
+
coercion ? "z.coerce.number().int()" : isV4() ? "z.int()" : "z.number().int()",
|
|
46
49
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
47
50
|
max !== void 0 ? `.max(${max})` : void 0
|
|
48
51
|
].filter(Boolean).join("");
|
|
49
52
|
},
|
|
50
|
-
|
|
53
|
+
interface: (value, strict) => {
|
|
54
|
+
if (strict) {
|
|
55
|
+
return `z.strictInterface({
|
|
56
|
+
${value}
|
|
57
|
+
})`;
|
|
58
|
+
}
|
|
59
|
+
return `z.interface({
|
|
60
|
+
${value}
|
|
61
|
+
})`;
|
|
62
|
+
},
|
|
63
|
+
object: (value, strict) => {
|
|
64
|
+
if (isV4() && strict) {
|
|
65
|
+
return `z.strictObject({
|
|
66
|
+
${value}
|
|
67
|
+
})`;
|
|
68
|
+
}
|
|
69
|
+
if (strict) {
|
|
70
|
+
return `z.object({
|
|
71
|
+
${value}
|
|
72
|
+
}).strict()`;
|
|
73
|
+
}
|
|
51
74
|
return `z.object({
|
|
52
75
|
${value}
|
|
53
76
|
})`;
|
|
@@ -55,6 +78,7 @@ var zodKeywordMapper = {
|
|
|
55
78
|
string: (coercion, min, max) => {
|
|
56
79
|
return [coercion ? "z.coerce.string()" : "z.string()", min !== void 0 ? `.min(${min})` : void 0, max !== void 0 ? `.max(${max})` : void 0].filter(Boolean).join("");
|
|
57
80
|
},
|
|
81
|
+
//support for discriminatedUnion
|
|
58
82
|
boolean: () => "z.boolean()",
|
|
59
83
|
undefined: () => "z.undefined()",
|
|
60
84
|
nullable: () => ".nullable()",
|
|
@@ -77,10 +101,10 @@ var zodKeywordMapper = {
|
|
|
77
101
|
*/
|
|
78
102
|
datetime: (offset = false, local = false) => {
|
|
79
103
|
if (offset) {
|
|
80
|
-
return `z.string().datetime({ offset: ${offset} })`;
|
|
104
|
+
return isV4() ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`;
|
|
81
105
|
}
|
|
82
106
|
if (local) {
|
|
83
|
-
return `z.string().datetime({ local: ${local} })`;
|
|
107
|
+
return isV4() ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`;
|
|
84
108
|
}
|
|
85
109
|
return "z.string().datetime()";
|
|
86
110
|
},
|
|
@@ -91,7 +115,7 @@ var zodKeywordMapper = {
|
|
|
91
115
|
*/
|
|
92
116
|
date: (type = "string", coercion) => {
|
|
93
117
|
if (type === "string") {
|
|
94
|
-
return "z.string().date()";
|
|
118
|
+
return isV4() ? "z.iso.date()" : "z.string().date()";
|
|
95
119
|
}
|
|
96
120
|
if (coercion) {
|
|
97
121
|
return "z.coerce.date()";
|
|
@@ -105,16 +129,15 @@ var zodKeywordMapper = {
|
|
|
105
129
|
*/
|
|
106
130
|
time: (type = "string", coercion) => {
|
|
107
131
|
if (type === "string") {
|
|
108
|
-
return "z.string().time()";
|
|
132
|
+
return isV4() ? "z.iso.time()" : "z.string().time()";
|
|
109
133
|
}
|
|
110
134
|
if (coercion) {
|
|
111
135
|
return "z.coerce.date()";
|
|
112
136
|
}
|
|
113
137
|
return "z.date()";
|
|
114
138
|
},
|
|
115
|
-
uuid: (coercion) => coercion ? "z.coerce.string().uuid()" : "z.string().uuid()",
|
|
116
|
-
url: (coercion) => coercion ? "z.coerce.string().url()" : "z.string().url()",
|
|
117
|
-
strict: () => ".strict()",
|
|
139
|
+
uuid: (coercion) => isV4() ? coercion ? "z.coerce.string().uuid()" : "z.uuid()" : coercion ? "z.coerce.string().uuid()" : "z.string().uuid()",
|
|
140
|
+
url: (coercion) => isV4() ? coercion ? "z.coerce.string().url()" : "z.url()" : coercion ? "z.coerce.string().url()" : "z.string().url()",
|
|
118
141
|
default: (value) => {
|
|
119
142
|
if (typeof value === "object") {
|
|
120
143
|
return ".default({})";
|
|
@@ -127,7 +150,7 @@ var zodKeywordMapper = {
|
|
|
127
150
|
max: (value) => `.max(${value ?? ""})`,
|
|
128
151
|
optional: () => ".optional()",
|
|
129
152
|
matches: (value = "", coercion) => coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`,
|
|
130
|
-
email: (coercion) => coercion ? "z.coerce.string().email()" : "z.string().email()",
|
|
153
|
+
email: (coercion) => isV4() ? coercion ? "z.coerce.string().email()" : "z.email()" : coercion ? "z.coerce.string().email()" : "z.string().email()",
|
|
131
154
|
firstName: void 0,
|
|
132
155
|
lastName: void 0,
|
|
133
156
|
password: void 0,
|
|
@@ -138,7 +161,7 @@ var zodKeywordMapper = {
|
|
|
138
161
|
if (!value) {
|
|
139
162
|
return void 0;
|
|
140
163
|
}
|
|
141
|
-
return `z.lazy(() => ${value})`;
|
|
164
|
+
return isV4() ? value : `z.lazy(() => ${value})`;
|
|
142
165
|
},
|
|
143
166
|
blob: () => "z.instanceof(File)",
|
|
144
167
|
deprecated: void 0,
|
|
@@ -251,22 +274,31 @@ function parse({ parent, current, siblings }, options) {
|
|
|
251
274
|
return zodKeywordMapper.ref(current.args?.name);
|
|
252
275
|
}
|
|
253
276
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.object)) {
|
|
254
|
-
const
|
|
277
|
+
const propertyEntries = Object.entries(current.args?.properties || {}).filter((item) => {
|
|
255
278
|
const schema = item[1];
|
|
256
279
|
return schema && typeof schema.map === "function";
|
|
257
|
-
})
|
|
280
|
+
});
|
|
281
|
+
const hasReferences = propertyEntries.some(([_name, schemas]) => {
|
|
282
|
+
return pluginOas.SchemaGenerator.find(schemas, pluginOas.schemaKeywords.ref);
|
|
283
|
+
});
|
|
284
|
+
const properties = propertyEntries.map(([name, schemas]) => {
|
|
258
285
|
const nameSchema = schemas.find((schema) => schema.keyword === pluginOas.schemaKeywords.name);
|
|
259
286
|
const mappedName = nameSchema?.args || name;
|
|
260
287
|
if (options.mapper?.[mappedName]) {
|
|
261
288
|
return `"${name}": ${options.mapper?.[mappedName]}`;
|
|
262
289
|
}
|
|
263
290
|
const baseSchemaOutput = sort(schemas).map((schema) => parse({ parent: current, current: schema, siblings: schemas }, options)).filter(Boolean).join("");
|
|
264
|
-
|
|
291
|
+
const objectValue = options.wrapOutput ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput : baseSchemaOutput;
|
|
292
|
+
if (isV4() && pluginOas.SchemaGenerator.find(schemas, pluginOas.schemaKeywords.ref)) {
|
|
293
|
+
return `get ${name}(){
|
|
294
|
+
return ${objectValue}
|
|
295
|
+
}`;
|
|
296
|
+
}
|
|
297
|
+
return `"${name}": ${objectValue}`;
|
|
265
298
|
}).join(",\n");
|
|
266
299
|
const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((schema, _index, siblings2) => parse({ parent: current, current: schema, siblings: siblings2 }, options)).filter(Boolean).join("") : void 0;
|
|
267
300
|
const text = [
|
|
268
|
-
zodKeywordMapper.object(properties),
|
|
269
|
-
current.args?.strict ? zodKeywordMapper.strict() : void 0,
|
|
301
|
+
hasReferences && isV4() ? zodKeywordMapper.interface(properties, current.args?.strict) : zodKeywordMapper.object(properties, current.args?.strict),
|
|
270
302
|
additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : void 0
|
|
271
303
|
].filter(Boolean);
|
|
272
304
|
return text.join("");
|
|
@@ -392,5 +424,5 @@ function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion,
|
|
|
392
424
|
|
|
393
425
|
exports.Operations = Operations;
|
|
394
426
|
exports.Zod = Zod;
|
|
395
|
-
//# sourceMappingURL=chunk-
|
|
396
|
-
//# sourceMappingURL=chunk-
|
|
427
|
+
//# sourceMappingURL=chunk-HQATWJUR.cjs.map
|
|
428
|
+
//# sourceMappingURL=chunk-HQATWJUR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"names":["jsxs","Fragment","jsx","File","Const","transformers","PackageManager","schemaKeywords","isKeyword","siblings","SchemaGenerator","value","Type"],"mappings":";;;;;;;;;;;;;AAWO,SAAS,UAAW,CAAA,EAAE,IAAM,EAAA,UAAA,EAAqB,EAAA;AACtD,EAAA,MAAM,iBAAiB,UAAW,CAAA,MAAA;AAAA,IAChC,CAAC,MAAM,GAAQ,KAAA;AACb,MAAA,IAAA,CAAK,IAAI,GAAI,CAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA,CAAG,IAAI,GAAI,CAAA,IAAA;AAElD,MAAO,OAAA,IAAA;AAAA,KACT;AAAA,IACA;AAAC,GACH;AAEA,EAAA,MAAM,YAAY,UAAW,CAAA,MAAA;AAAA,IAC3B,CAAC,MAAM,GAAQ,KAAA;AACb,MA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a,CAAA,cAAA,CAAe,WAAW,CAAC,CAAK,CAAA,GAAA,MAAS,CAAE,CAAA,MAAA,CAAO,OAAO;AAAA,SACjH;AAAA,QAEC,QAAA,EAAA;AAAA;AAAA,KAEL,EAAA,CAAA;AAAA,IACC,aACC,oBAAAL,eAACG,CAAAA,UAAAA,CAAK,MAAL,EAAA,EAAY,IAAM,EAAA,aAAA,EAAe,YAAY,EAAA,IAAA,EAAC,WAAW,EAAA,IAAA,EAAC,YAAU,IAClE,EAAA,QAAA,EAAA;AAAA,MAAA,QAAA,oBACCD,cAAC,CAAAU,UAAA,EAAA,EAAK,QAAM,IAAC,EAAA,IAAA,EAAM,eAChB,QACH,EAAA,QAAA,EAAA,CAAA;AAAA,MAED,CAAC,QACA,oBAAAV,cAAC,CAAAU,UAAA,EAAA,EAAK,MAAM,EAAA,IAAA,EAAC,IAAM,EAAA,aAAA,EAChB,QAAkB,EAAA,CAAA,eAAA,EAAA,IAAI,CACzB,CAAA,CAAA,EAAA;AAAA,KAEJ,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ","file":"chunk-HQATWJUR.cjs","sourcesContent":["import type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props) {\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={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'\nimport type { SchemaObject } from '@kubb/oas'\nimport { SchemaGenerator, type SchemaKeywordMapper, type SchemaTree, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { Schema, SchemaKeywordBase, SchemaMapper } from '@kubb/plugin-oas'\nimport { PackageManager } from '@kubb/core'\n\nconst packageManager = new PackageManager()\nconst isV4 = () => packageManager.isValidSync('zod', '>=4') || packageManager.isValidSync('zod', 'next')\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number) => {\n return [coercion ? 'z.coerce.number()' : 'z.number()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number) => {\n return [\n coercion ? 'z.coerce.number().int()' : isV4() ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : 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) => {\n if (isV4() && 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) => {\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: () => '.nullable()',\n null: () => 'z.null()',\n nullish: () => '.nullish()',\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean) => {\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) => {\n if (offset) {\n return isV4() ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return isV4() ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return '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) => {\n if (type === 'string') {\n return isV4() ? '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) => {\n if (type === 'string') {\n return isV4() ? '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) => (isV4() ? (coercion ? 'z.coerce.string().uuid()' : 'z.uuid()') : coercion ? 'z.coerce.string().uuid()' : 'z.string().uuid()'),\n url: (coercion?: boolean) => (isV4() ? (coercion ? 'z.coerce.string().url()' : 'z.url()') : coercion ? 'z.coerce.string().url()' : 'z.string().url()'),\n default: (value?: string | number | true | object) => {\n if (typeof value === 'object') {\n return '.default({})'\n }\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = []) => items?.map((item) => `.and(${item})`).join(''),\n describe: (value = '') => `.describe(${value})`,\n min: (value?: number) => `.min(${value ?? ''})`,\n max: (value?: number) => `.max(${value ?? ''})`,\n optional: () => '.optional()',\n matches: (value = '', coercion?: boolean) => (coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`),\n email: (coercion?: boolean) =>\n isV4() ? (coercion ? 'z.coerce.string().email()' : 'z.email()') : coercion ? 'z.coerce.string().email()' : 'z.string().email()',\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 isV4() ? value : `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string) => (value ? `.catchall(${value})` : undefined),\n name: 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\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 name: string\n typeName?: string\n description?: string\n keysToOmit?: string[]\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n rawSchema: SchemaObject\n}\n\nexport function parse({ parent, current, siblings }: SchemaTree, options: ParserOptions): string | undefined {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return parse({ parent, 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((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean),\n )\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\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((schema: Schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1))}`\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((schemas, _index, siblings) => parse({ parent: current, current: schemas, siblings }, options))\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n )\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\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 parse({ parent: current, 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((schema, _index, siblings) => {\n return parse({ parent: current, current: schema, 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\n if (isKeyword(current, schemaKeywords.ref)) {\n return zodKeywordMapper.ref(current.args?.name)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\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 hasReferences = propertyEntries.some(([_name, schemas]) => {\n return SchemaGenerator.find(schemas, schemaKeywords.ref)\n })\n\n const properties = propertyEntries\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .map((schema) => parse({ parent: current, current: schema, siblings: schemas }, options))\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (isV4() && SchemaGenerator.find(schemas, schemaKeywords.ref)) {\n return `get ${name}(){\n return ${objectValue}\n }`\n }\n\n return `\"${name}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n hasReferences && isV4() ? zodKeywordMapper.interface(properties, current.args?.strict) : zodKeywordMapper.object(properties, current.args?.strict),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return zodKeywordMapper.tuple(\n current.args.items.map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean),\n )\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number.parseInt(current.args.value?.toString()))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(current.args.value)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n }\n\n if (isKeyword(current, schemaKeywords.matches)) {\n if (current.args) {\n return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, 'strings'))\n }\n }\n\n if (isKeyword(current, schemaKeywords.default)) {\n if (current.args) {\n return zodKeywordMapper.default(current.args)\n }\n }\n\n if (isKeyword(current, schemaKeywords.describe)) {\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()))\n }\n }\n\n if (isKeyword(current, schemaKeywords.string)) {\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.uuid)) {\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.email)) {\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.url)) {\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.number)) {\n return zodKeywordMapper.number(shouldCoerce(options.coercion, 'numbers'))\n }\n\n if (isKeyword(current, schemaKeywords.integer)) {\n return zodKeywordMapper.integer(shouldCoerce(options.coercion, 'numbers'))\n }\n\n if (isKeyword(current, schemaKeywords.min)) {\n return zodKeywordMapper.min(current.args)\n }\n if (isKeyword(current, schemaKeywords.max)) {\n return zodKeywordMapper.max(current.args)\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return zodKeywordMapper.datetime(current.args.offset, current.args.local)\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'))\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'))\n }\n\n if (current.keyword in zodKeywordMapper && 'args' in current) {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper] as (typeof zodKeywordMapper)['const']\n\n return value((current as SchemaKeywordBase<unknown>).args as any)\n }\n\n if (isKeyword(current, schemaKeywords.optional)) {\n if (siblings.some((schema) => isKeyword(schema, schemaKeywords.default))) return ''\n\n return value()\n }\n\n if (current.keyword in zodKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import transformers from '@kubb/core/transformers'\nimport { type Schema, schemaKeywords } from '@kubb/plugin-oas'\nimport { isKeyword } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\nimport type { SchemaObject } from '@kubb/oas'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n rawSchema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n}\n\nexport function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion, keysToOmit, description, wrapOutput }: Props) {\n const hasTuple = tree.some((item) => isKeyword(item, schemaKeywords.tuple))\n\n const output = parserZod\n .sort(tree)\n .filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n .map((schema, _index, siblings) =>\n parserZod.parse({ parent: undefined, current: schema, siblings }, { name, keysToOmit, typeName, description, mapper, coercion, wrapOutput, rawSchema }),\n )\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n\n if (output.endsWith('.nullable()')) {\n if (output.startsWith('z.lazy')) {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap()'\n }\n } else {\n if (output.startsWith('z.lazy')) {\n suffix = '.schema'\n }\n }\n\n const baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `${key}: true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n 'z.undefined()'\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema: rawSchema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as 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"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { File, Const, Type } from '@kubb/react';
|
|
2
2
|
import transformers2 from '@kubb/core/transformers';
|
|
3
3
|
import { jsxs, Fragment, jsx } from '@kubb/react/jsx-runtime';
|
|
4
|
-
import { isKeyword, schemaKeywords } from '@kubb/plugin-oas';
|
|
4
|
+
import { isKeyword, schemaKeywords, SchemaGenerator } from '@kubb/plugin-oas';
|
|
5
|
+
import { PackageManager } from '@kubb/core';
|
|
5
6
|
|
|
6
7
|
// src/components/Operations.tsx
|
|
7
8
|
function Operations({ name, operations }) {
|
|
@@ -27,6 +28,8 @@ function Operations({ name, operations }) {
|
|
|
27
28
|
/* @__PURE__ */ jsx(File.Source, { name: "paths", isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Const, { export: true, name: "paths", asConst: true, children: `{${transformers2.stringifyObject(pathsJSON)}}` }) })
|
|
28
29
|
] });
|
|
29
30
|
}
|
|
31
|
+
var packageManager = new PackageManager();
|
|
32
|
+
var isV4 = () => packageManager.isValidSync("zod", ">=4") || packageManager.isValidSync("zod", "next");
|
|
30
33
|
var zodKeywordMapper = {
|
|
31
34
|
any: () => "z.any()",
|
|
32
35
|
unknown: () => "z.unknown()",
|
|
@@ -36,12 +39,32 @@ var zodKeywordMapper = {
|
|
|
36
39
|
},
|
|
37
40
|
integer: (coercion, min, max) => {
|
|
38
41
|
return [
|
|
39
|
-
coercion ? "z.coerce.number().int()" : "z.number().int()",
|
|
42
|
+
coercion ? "z.coerce.number().int()" : isV4() ? "z.int()" : "z.number().int()",
|
|
40
43
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
41
44
|
max !== void 0 ? `.max(${max})` : void 0
|
|
42
45
|
].filter(Boolean).join("");
|
|
43
46
|
},
|
|
44
|
-
|
|
47
|
+
interface: (value, strict) => {
|
|
48
|
+
if (strict) {
|
|
49
|
+
return `z.strictInterface({
|
|
50
|
+
${value}
|
|
51
|
+
})`;
|
|
52
|
+
}
|
|
53
|
+
return `z.interface({
|
|
54
|
+
${value}
|
|
55
|
+
})`;
|
|
56
|
+
},
|
|
57
|
+
object: (value, strict) => {
|
|
58
|
+
if (isV4() && strict) {
|
|
59
|
+
return `z.strictObject({
|
|
60
|
+
${value}
|
|
61
|
+
})`;
|
|
62
|
+
}
|
|
63
|
+
if (strict) {
|
|
64
|
+
return `z.object({
|
|
65
|
+
${value}
|
|
66
|
+
}).strict()`;
|
|
67
|
+
}
|
|
45
68
|
return `z.object({
|
|
46
69
|
${value}
|
|
47
70
|
})`;
|
|
@@ -49,6 +72,7 @@ var zodKeywordMapper = {
|
|
|
49
72
|
string: (coercion, min, max) => {
|
|
50
73
|
return [coercion ? "z.coerce.string()" : "z.string()", min !== void 0 ? `.min(${min})` : void 0, max !== void 0 ? `.max(${max})` : void 0].filter(Boolean).join("");
|
|
51
74
|
},
|
|
75
|
+
//support for discriminatedUnion
|
|
52
76
|
boolean: () => "z.boolean()",
|
|
53
77
|
undefined: () => "z.undefined()",
|
|
54
78
|
nullable: () => ".nullable()",
|
|
@@ -71,10 +95,10 @@ var zodKeywordMapper = {
|
|
|
71
95
|
*/
|
|
72
96
|
datetime: (offset = false, local = false) => {
|
|
73
97
|
if (offset) {
|
|
74
|
-
return `z.string().datetime({ offset: ${offset} })`;
|
|
98
|
+
return isV4() ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`;
|
|
75
99
|
}
|
|
76
100
|
if (local) {
|
|
77
|
-
return `z.string().datetime({ local: ${local} })`;
|
|
101
|
+
return isV4() ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`;
|
|
78
102
|
}
|
|
79
103
|
return "z.string().datetime()";
|
|
80
104
|
},
|
|
@@ -85,7 +109,7 @@ var zodKeywordMapper = {
|
|
|
85
109
|
*/
|
|
86
110
|
date: (type = "string", coercion) => {
|
|
87
111
|
if (type === "string") {
|
|
88
|
-
return "z.string().date()";
|
|
112
|
+
return isV4() ? "z.iso.date()" : "z.string().date()";
|
|
89
113
|
}
|
|
90
114
|
if (coercion) {
|
|
91
115
|
return "z.coerce.date()";
|
|
@@ -99,16 +123,15 @@ var zodKeywordMapper = {
|
|
|
99
123
|
*/
|
|
100
124
|
time: (type = "string", coercion) => {
|
|
101
125
|
if (type === "string") {
|
|
102
|
-
return "z.string().time()";
|
|
126
|
+
return isV4() ? "z.iso.time()" : "z.string().time()";
|
|
103
127
|
}
|
|
104
128
|
if (coercion) {
|
|
105
129
|
return "z.coerce.date()";
|
|
106
130
|
}
|
|
107
131
|
return "z.date()";
|
|
108
132
|
},
|
|
109
|
-
uuid: (coercion) => coercion ? "z.coerce.string().uuid()" : "z.string().uuid()",
|
|
110
|
-
url: (coercion) => coercion ? "z.coerce.string().url()" : "z.string().url()",
|
|
111
|
-
strict: () => ".strict()",
|
|
133
|
+
uuid: (coercion) => isV4() ? coercion ? "z.coerce.string().uuid()" : "z.uuid()" : coercion ? "z.coerce.string().uuid()" : "z.string().uuid()",
|
|
134
|
+
url: (coercion) => isV4() ? coercion ? "z.coerce.string().url()" : "z.url()" : coercion ? "z.coerce.string().url()" : "z.string().url()",
|
|
112
135
|
default: (value) => {
|
|
113
136
|
if (typeof value === "object") {
|
|
114
137
|
return ".default({})";
|
|
@@ -121,7 +144,7 @@ var zodKeywordMapper = {
|
|
|
121
144
|
max: (value) => `.max(${value ?? ""})`,
|
|
122
145
|
optional: () => ".optional()",
|
|
123
146
|
matches: (value = "", coercion) => coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`,
|
|
124
|
-
email: (coercion) => coercion ? "z.coerce.string().email()" : "z.string().email()",
|
|
147
|
+
email: (coercion) => isV4() ? coercion ? "z.coerce.string().email()" : "z.email()" : coercion ? "z.coerce.string().email()" : "z.string().email()",
|
|
125
148
|
firstName: void 0,
|
|
126
149
|
lastName: void 0,
|
|
127
150
|
password: void 0,
|
|
@@ -132,7 +155,7 @@ var zodKeywordMapper = {
|
|
|
132
155
|
if (!value) {
|
|
133
156
|
return void 0;
|
|
134
157
|
}
|
|
135
|
-
return `z.lazy(() => ${value})`;
|
|
158
|
+
return isV4() ? value : `z.lazy(() => ${value})`;
|
|
136
159
|
},
|
|
137
160
|
blob: () => "z.instanceof(File)",
|
|
138
161
|
deprecated: void 0,
|
|
@@ -245,22 +268,31 @@ function parse({ parent, current, siblings }, options) {
|
|
|
245
268
|
return zodKeywordMapper.ref(current.args?.name);
|
|
246
269
|
}
|
|
247
270
|
if (isKeyword(current, schemaKeywords.object)) {
|
|
248
|
-
const
|
|
271
|
+
const propertyEntries = Object.entries(current.args?.properties || {}).filter((item) => {
|
|
249
272
|
const schema = item[1];
|
|
250
273
|
return schema && typeof schema.map === "function";
|
|
251
|
-
})
|
|
274
|
+
});
|
|
275
|
+
const hasReferences = propertyEntries.some(([_name, schemas]) => {
|
|
276
|
+
return SchemaGenerator.find(schemas, schemaKeywords.ref);
|
|
277
|
+
});
|
|
278
|
+
const properties = propertyEntries.map(([name, schemas]) => {
|
|
252
279
|
const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name);
|
|
253
280
|
const mappedName = nameSchema?.args || name;
|
|
254
281
|
if (options.mapper?.[mappedName]) {
|
|
255
282
|
return `"${name}": ${options.mapper?.[mappedName]}`;
|
|
256
283
|
}
|
|
257
284
|
const baseSchemaOutput = sort(schemas).map((schema) => parse({ parent: current, current: schema, siblings: schemas }, options)).filter(Boolean).join("");
|
|
258
|
-
|
|
285
|
+
const objectValue = options.wrapOutput ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput : baseSchemaOutput;
|
|
286
|
+
if (isV4() && SchemaGenerator.find(schemas, schemaKeywords.ref)) {
|
|
287
|
+
return `get ${name}(){
|
|
288
|
+
return ${objectValue}
|
|
289
|
+
}`;
|
|
290
|
+
}
|
|
291
|
+
return `"${name}": ${objectValue}`;
|
|
259
292
|
}).join(",\n");
|
|
260
293
|
const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((schema, _index, siblings2) => parse({ parent: current, current: schema, siblings: siblings2 }, options)).filter(Boolean).join("") : void 0;
|
|
261
294
|
const text = [
|
|
262
|
-
zodKeywordMapper.object(properties),
|
|
263
|
-
current.args?.strict ? zodKeywordMapper.strict() : void 0,
|
|
295
|
+
hasReferences && isV4() ? zodKeywordMapper.interface(properties, current.args?.strict) : zodKeywordMapper.object(properties, current.args?.strict),
|
|
264
296
|
additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : void 0
|
|
265
297
|
].filter(Boolean);
|
|
266
298
|
return text.join("");
|
|
@@ -385,5 +417,5 @@ function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion,
|
|
|
385
417
|
}
|
|
386
418
|
|
|
387
419
|
export { Operations, Zod };
|
|
388
|
-
//# sourceMappingURL=chunk-
|
|
389
|
-
//# sourceMappingURL=chunk-
|
|
420
|
+
//# sourceMappingURL=chunk-PQF3NNR6.js.map
|
|
421
|
+
//# sourceMappingURL=chunk-PQF3NNR6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"names":["transformers","siblings","value","isKeyword","schemaKeywords","jsxs","Fragment","jsx","File","Const"],"mappings":";;;;;;;AAWO,SAAS,UAAW,CAAA,EAAE,IAAM,EAAA,UAAA,EAAqB,EAAA;AACtD,EAAA,MAAM,iBAAiB,UAAW,CAAA,MAAA;AAAA,IAChC,CAAC,MAAM,GAAQ,KAAA;AACb,MAAA,IAAA,CAAK,IAAI,GAAI,CAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA,CAAG,IAAI,GAAI,CAAA,IAAA;AAElD,MAAO,OAAA,IAAA;AAAA,KACT;AAAA,IACA;AAAC,GACH;AAEA,EAAA,MAAM,YAAY,UAAW,CAAA,MAAA;AAAA,IAC3B,CAAC,MAAM,GAAQ,KAAA;AACb,MAAA,IAAA,CAAK,CAAI,CAAA,EAAA,GAAA,CAAI,SAAU,CAAA,IAAI,GAAG,CAAI,GAAA;AAAA,QAChC,GAAI,KAAK,CAAI,CAAA,EAAA,GAAA,CAAI,UAAU,IAAI,CAAA,CAAA,CAAG,KAAM,EAAC;AAAA,QACzC,CAAC,IAAI,SAAU,CAAA,MAAM,GAAG,CAAe,YAAA,EAA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EAAA,CAAA;AAAA,MAED,CAAC,QACA,oBAAAA,GAAC,CAAA,IAAA,EAAA,EAAK,MAAM,EAAA,IAAA,EAAC,IAAM,EAAA,aAAA,EAChB,QAAkB,EAAA,CAAA,eAAA,EAAA,IAAI,CACzB,CAAA,CAAA,EAAA;AAAA,KAEJ,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ","file":"chunk-PQF3NNR6.js","sourcesContent":["import type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props) {\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={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'\nimport type { SchemaObject } from '@kubb/oas'\nimport { SchemaGenerator, type SchemaKeywordMapper, type SchemaTree, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { Schema, SchemaKeywordBase, SchemaMapper } from '@kubb/plugin-oas'\nimport { PackageManager } from '@kubb/core'\n\nconst packageManager = new PackageManager()\nconst isV4 = () => packageManager.isValidSync('zod', '>=4') || packageManager.isValidSync('zod', 'next')\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number) => {\n return [coercion ? 'z.coerce.number()' : 'z.number()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number) => {\n return [\n coercion ? 'z.coerce.number().int()' : isV4() ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : 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) => {\n if (isV4() && 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) => {\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: () => '.nullable()',\n null: () => 'z.null()',\n nullish: () => '.nullish()',\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean) => {\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) => {\n if (offset) {\n return isV4() ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return isV4() ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return '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) => {\n if (type === 'string') {\n return isV4() ? '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) => {\n if (type === 'string') {\n return isV4() ? '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) => (isV4() ? (coercion ? 'z.coerce.string().uuid()' : 'z.uuid()') : coercion ? 'z.coerce.string().uuid()' : 'z.string().uuid()'),\n url: (coercion?: boolean) => (isV4() ? (coercion ? 'z.coerce.string().url()' : 'z.url()') : coercion ? 'z.coerce.string().url()' : 'z.string().url()'),\n default: (value?: string | number | true | object) => {\n if (typeof value === 'object') {\n return '.default({})'\n }\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = []) => items?.map((item) => `.and(${item})`).join(''),\n describe: (value = '') => `.describe(${value})`,\n min: (value?: number) => `.min(${value ?? ''})`,\n max: (value?: number) => `.max(${value ?? ''})`,\n optional: () => '.optional()',\n matches: (value = '', coercion?: boolean) => (coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`),\n email: (coercion?: boolean) =>\n isV4() ? (coercion ? 'z.coerce.string().email()' : 'z.email()') : coercion ? 'z.coerce.string().email()' : 'z.string().email()',\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 isV4() ? value : `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string) => (value ? `.catchall(${value})` : undefined),\n name: 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\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 name: string\n typeName?: string\n description?: string\n keysToOmit?: string[]\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n rawSchema: SchemaObject\n}\n\nexport function parse({ parent, current, siblings }: SchemaTree, options: ParserOptions): string | undefined {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return parse({ parent, 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((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean),\n )\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\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((schema: Schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1))}`\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((schemas, _index, siblings) => parse({ parent: current, current: schemas, siblings }, options))\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n )\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\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 parse({ parent: current, 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((schema, _index, siblings) => {\n return parse({ parent: current, current: schema, 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\n if (isKeyword(current, schemaKeywords.ref)) {\n return zodKeywordMapper.ref(current.args?.name)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\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 hasReferences = propertyEntries.some(([_name, schemas]) => {\n return SchemaGenerator.find(schemas, schemaKeywords.ref)\n })\n\n const properties = propertyEntries\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .map((schema) => parse({ parent: current, current: schema, siblings: schemas }, options))\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (isV4() && SchemaGenerator.find(schemas, schemaKeywords.ref)) {\n return `get ${name}(){\n return ${objectValue}\n }`\n }\n\n return `\"${name}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n hasReferences && isV4() ? zodKeywordMapper.interface(properties, current.args?.strict) : zodKeywordMapper.object(properties, current.args?.strict),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return zodKeywordMapper.tuple(\n current.args.items.map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean),\n )\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number.parseInt(current.args.value?.toString()))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(current.args.value)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n }\n\n if (isKeyword(current, schemaKeywords.matches)) {\n if (current.args) {\n return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, 'strings'))\n }\n }\n\n if (isKeyword(current, schemaKeywords.default)) {\n if (current.args) {\n return zodKeywordMapper.default(current.args)\n }\n }\n\n if (isKeyword(current, schemaKeywords.describe)) {\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()))\n }\n }\n\n if (isKeyword(current, schemaKeywords.string)) {\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.uuid)) {\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.email)) {\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.url)) {\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.number)) {\n return zodKeywordMapper.number(shouldCoerce(options.coercion, 'numbers'))\n }\n\n if (isKeyword(current, schemaKeywords.integer)) {\n return zodKeywordMapper.integer(shouldCoerce(options.coercion, 'numbers'))\n }\n\n if (isKeyword(current, schemaKeywords.min)) {\n return zodKeywordMapper.min(current.args)\n }\n if (isKeyword(current, schemaKeywords.max)) {\n return zodKeywordMapper.max(current.args)\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return zodKeywordMapper.datetime(current.args.offset, current.args.local)\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'))\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'))\n }\n\n if (current.keyword in zodKeywordMapper && 'args' in current) {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper] as (typeof zodKeywordMapper)['const']\n\n return value((current as SchemaKeywordBase<unknown>).args as any)\n }\n\n if (isKeyword(current, schemaKeywords.optional)) {\n if (siblings.some((schema) => isKeyword(schema, schemaKeywords.default))) return ''\n\n return value()\n }\n\n if (current.keyword in zodKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import transformers from '@kubb/core/transformers'\nimport { type Schema, schemaKeywords } from '@kubb/plugin-oas'\nimport { isKeyword } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\nimport type { SchemaObject } from '@kubb/oas'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n rawSchema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n}\n\nexport function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion, keysToOmit, description, wrapOutput }: Props) {\n const hasTuple = tree.some((item) => isKeyword(item, schemaKeywords.tuple))\n\n const output = parserZod\n .sort(tree)\n .filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n .map((schema, _index, siblings) =>\n parserZod.parse({ parent: undefined, current: schema, siblings }, { name, keysToOmit, typeName, description, mapper, coercion, wrapOutput, rawSchema }),\n )\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n\n if (output.endsWith('.nullable()')) {\n if (output.startsWith('z.lazy')) {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap()'\n }\n } else {\n if (output.startsWith('z.lazy')) {\n suffix = '.schema'\n }\n }\n\n const baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `${key}: true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n 'z.undefined()'\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema: rawSchema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as 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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHQATWJUR_cjs = require('./chunk-HQATWJUR.cjs');
|
|
4
4
|
var pluginOas = require('@kubb/plugin-oas');
|
|
5
5
|
var components = require('@kubb/plugin-oas/components');
|
|
6
6
|
var hooks = require('@kubb/plugin-oas/hooks');
|
|
@@ -53,7 +53,7 @@ var zodGenerator = pluginOas.createReactGenerator({
|
|
|
53
53
|
typed && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, path: "@kubb/plugin-zod/utils", name: ["ToZod"] }),
|
|
54
54
|
imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: file.path, path: imp.path, name: imp.name }, index)),
|
|
55
55
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
-
|
|
56
|
+
chunkHQATWJUR_cjs.Zod,
|
|
57
57
|
{
|
|
58
58
|
name: zod.name,
|
|
59
59
|
typeName: typed ? type.name : void 0,
|
|
@@ -75,7 +75,7 @@ var zodGenerator = pluginOas.createReactGenerator({
|
|
|
75
75
|
baseName: file.baseName,
|
|
76
76
|
path: file.path,
|
|
77
77
|
meta: file.meta,
|
|
78
|
-
banner: utils.getBanner({ oas, output: plugin.options.output }),
|
|
78
|
+
banner: utils.getBanner({ oas, output: plugin.options.output, config: pluginManager.config }),
|
|
79
79
|
footer: utils.getFooter({ oas, output: plugin.options.output }),
|
|
80
80
|
children: [
|
|
81
81
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["z"], path: plugin.options.importPath }),
|
|
@@ -88,6 +88,7 @@ var zodGenerator = pluginOas.createReactGenerator({
|
|
|
88
88
|
const { coercion, inferred, typed, mapper, importPath, wrapOutput } = options;
|
|
89
89
|
const { getName, getFile, getImports } = hooks.useSchemaManager();
|
|
90
90
|
const {
|
|
91
|
+
pluginManager,
|
|
91
92
|
plugin: {
|
|
92
93
|
options: { output }
|
|
93
94
|
}
|
|
@@ -103,26 +104,36 @@ var zodGenerator = pluginOas.createReactGenerator({
|
|
|
103
104
|
name: getName(schema.name, { type: "type", pluginKey: [pluginTs.pluginTsName] }),
|
|
104
105
|
file: getFile(schema.name, { pluginKey: [pluginTs.pluginTsName] })
|
|
105
106
|
};
|
|
106
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
107
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
108
|
+
react.File,
|
|
109
|
+
{
|
|
110
|
+
baseName: zod.file.baseName,
|
|
111
|
+
path: zod.file.path,
|
|
112
|
+
meta: zod.file.meta,
|
|
113
|
+
banner: utils.getBanner({ oas, output, config: pluginManager.config }),
|
|
114
|
+
footer: utils.getFooter({ oas, output }),
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["z"], path: importPath }),
|
|
117
|
+
typed && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, root: zod.file.path, path: type.file.path, name: [type.name] }),
|
|
118
|
+
typed && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, path: "@kubb/plugin-zod/utils", name: ["ToZod"] }),
|
|
119
|
+
imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: zod.file.path, path: imp.path, name: imp.name }, index)),
|
|
120
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
chunkHQATWJUR_cjs.Zod,
|
|
122
|
+
{
|
|
123
|
+
name: zod.name,
|
|
124
|
+
typeName: typed ? type.name : void 0,
|
|
125
|
+
inferTypeName: inferred ? zod.inferTypeName : void 0,
|
|
126
|
+
description: schema.value.description,
|
|
127
|
+
tree: schema.tree,
|
|
128
|
+
rawSchema: schema.value,
|
|
129
|
+
mapper,
|
|
130
|
+
coercion,
|
|
131
|
+
wrapOutput
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
126
137
|
}
|
|
127
138
|
});
|
|
128
139
|
var operationsGenerator = pluginOas.createReactGenerator({
|
|
@@ -144,14 +155,24 @@ var operationsGenerator = pluginOas.createReactGenerator({
|
|
|
144
155
|
const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean);
|
|
145
156
|
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: names, root: file.path, path: getFile(operation).path }, key);
|
|
146
157
|
}).filter(Boolean);
|
|
147
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
159
|
+
react.File,
|
|
160
|
+
{
|
|
161
|
+
baseName: file.baseName,
|
|
162
|
+
path: file.path,
|
|
163
|
+
meta: file.meta,
|
|
164
|
+
banner: utils.getBanner({ oas, output, config: pluginManager.config }),
|
|
165
|
+
footer: utils.getFooter({ oas, output }),
|
|
166
|
+
children: [
|
|
167
|
+
imports,
|
|
168
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkHQATWJUR_cjs.Operations, { name, operations: transformedOperations })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
151
172
|
}
|
|
152
173
|
});
|
|
153
174
|
|
|
154
175
|
exports.operationsGenerator = operationsGenerator;
|
|
155
176
|
exports.zodGenerator = zodGenerator;
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
157
|
-
//# sourceMappingURL=chunk-
|
|
177
|
+
//# sourceMappingURL=chunk-RUWAB6W7.cjs.map
|
|
178
|
+
//# sourceMappingURL=chunk-RUWAB6W7.cjs.map
|