@kubb/plugin-zod 4.7.3 → 4.8.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/{components-CVRd05if.cjs → components-5OPJsyIm.cjs} +172 -33
- package/dist/components-5OPJsyIm.cjs.map +1 -0
- package/dist/{components-CQg0WVV7.js → components-DhgOJ6ja.js} +172 -33
- package/dist/components-DhgOJ6ja.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +4 -2
- package/dist/components.d.ts +4 -2
- package/dist/components.js +1 -1
- package/dist/{generators-Cx0larO4.js → generators-BUP3Ksen.js} +8 -6
- package/dist/generators-BUP3Ksen.js.map +1 -0
- package/dist/{generators-BrfrSmEP.cjs → generators-DLIvEhSD.cjs} +8 -6
- package/dist/generators-DLIvEhSD.cjs.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-D2GJboSe.d.cts → types-COTxGHzo.d.ts} +10 -2
- package/dist/{types-DVvVPDtF.d.ts → types-DX8evdsR.d.cts} +10 -2
- package/package.json +7 -7
- package/src/components/Zod.tsx +18 -7
- package/src/generators/zodGenerator.tsx +4 -2
- package/src/parser.ts +224 -20
- package/src/plugin.ts +4 -2
- package/src/types.ts +8 -0
- package/dist/components-CQg0WVV7.js.map +0 -1
- package/dist/components-CVRd05if.cjs.map +0 -1
- package/dist/generators-BrfrSmEP.cjs.map +0 -1
- package/dist/generators-Cx0larO4.js.map +0 -1
|
@@ -78,11 +78,29 @@ function Operations({ name, operations }) {
|
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/parser.ts
|
|
81
|
+
/**
|
|
82
|
+
* Helper to build string/array length constraint checks for Zod Mini mode
|
|
83
|
+
*/
|
|
84
|
+
function buildLengthChecks(min, max) {
|
|
85
|
+
const checks = [];
|
|
86
|
+
if (min !== void 0) checks.push(`z.minLength(${min})`);
|
|
87
|
+
if (max !== void 0) checks.push(`z.maxLength(${max})`);
|
|
88
|
+
return checks;
|
|
89
|
+
}
|
|
81
90
|
const zodKeywordMapper = {
|
|
82
91
|
any: () => "z.any()",
|
|
83
92
|
unknown: () => "z.unknown()",
|
|
84
93
|
void: () => "z.void()",
|
|
85
|
-
number: (coercion, min, max, exclusiveMinimum, exclusiveMaximum) => {
|
|
94
|
+
number: (coercion, min, max, exclusiveMinimum, exclusiveMaximum, mini) => {
|
|
95
|
+
if (mini) {
|
|
96
|
+
const checks = [];
|
|
97
|
+
if (min !== void 0) checks.push(`z.minimum(${min})`);
|
|
98
|
+
if (max !== void 0) checks.push(`z.maximum(${max})`);
|
|
99
|
+
if (exclusiveMinimum !== void 0) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`);
|
|
100
|
+
if (exclusiveMaximum !== void 0) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`);
|
|
101
|
+
if (checks.length > 0) return `z.number().check(${checks.join(", ")})`;
|
|
102
|
+
return "z.number()";
|
|
103
|
+
}
|
|
86
104
|
return [
|
|
87
105
|
coercion ? "z.coerce.number()" : "z.number()",
|
|
88
106
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
@@ -91,7 +109,16 @@ const zodKeywordMapper = {
|
|
|
91
109
|
exclusiveMaximum !== void 0 ? `.lt(${exclusiveMaximum})` : void 0
|
|
92
110
|
].filter(Boolean).join("");
|
|
93
111
|
},
|
|
94
|
-
integer: (coercion, min, max, version = "3", exclusiveMinimum, exclusiveMaximum) => {
|
|
112
|
+
integer: (coercion, min, max, version = "3", exclusiveMinimum, exclusiveMaximum, mini) => {
|
|
113
|
+
if (mini) {
|
|
114
|
+
const checks = [];
|
|
115
|
+
if (min !== void 0) checks.push(`z.minimum(${min})`);
|
|
116
|
+
if (max !== void 0) checks.push(`z.maximum(${max})`);
|
|
117
|
+
if (exclusiveMinimum !== void 0) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`);
|
|
118
|
+
if (exclusiveMaximum !== void 0) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`);
|
|
119
|
+
if (checks.length > 0) return `z.int().check(${checks.join(", ")})`;
|
|
120
|
+
return "z.int()";
|
|
121
|
+
}
|
|
95
122
|
return [
|
|
96
123
|
coercion ? "z.coerce.number().int()" : version === "4" ? "z.int()" : "z.number().int()",
|
|
97
124
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
@@ -119,7 +146,12 @@ const zodKeywordMapper = {
|
|
|
119
146
|
${value}
|
|
120
147
|
})`;
|
|
121
148
|
},
|
|
122
|
-
string: (coercion, min, max) => {
|
|
149
|
+
string: (coercion, min, max, mini) => {
|
|
150
|
+
if (mini) {
|
|
151
|
+
const checks = buildLengthChecks(min, max);
|
|
152
|
+
if (checks.length > 0) return `z.string().check(${checks.join(", ")})`;
|
|
153
|
+
return "z.string()";
|
|
154
|
+
}
|
|
123
155
|
return [
|
|
124
156
|
coercion ? "z.coerce.string()" : "z.string()",
|
|
125
157
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
@@ -137,7 +169,13 @@ const zodKeywordMapper = {
|
|
|
137
169
|
if (value) return `z.nullish(${value})`;
|
|
138
170
|
return ".nullish()";
|
|
139
171
|
},
|
|
140
|
-
array: (items = [], min, max, unique) => {
|
|
172
|
+
array: (items = [], min, max, unique, mini) => {
|
|
173
|
+
if (mini) {
|
|
174
|
+
const checks = buildLengthChecks(min, max);
|
|
175
|
+
if (unique) checks.push(`z.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })`);
|
|
176
|
+
if (checks.length > 0) return `z.array(${items?.join("")}).check(${checks.join(", ")})`;
|
|
177
|
+
return `z.array(${items?.join("")})`;
|
|
178
|
+
}
|
|
141
179
|
return [
|
|
142
180
|
`z.array(${items?.join("")})`,
|
|
143
181
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
@@ -149,7 +187,8 @@ const zodKeywordMapper = {
|
|
|
149
187
|
enum: (items = []) => `z.enum([${items?.join(", ")}])`,
|
|
150
188
|
union: (items = []) => `z.union([${items?.join(", ")}])`,
|
|
151
189
|
const: (value) => `z.literal(${value ?? ""})`,
|
|
152
|
-
datetime: (offset = false, local = false, version = "3") => {
|
|
190
|
+
datetime: (offset = false, local = false, version = "3", mini) => {
|
|
191
|
+
if (mini) return "z.string()";
|
|
153
192
|
if (offset) return version === "4" ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`;
|
|
154
193
|
if (local) return version === "4" ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`;
|
|
155
194
|
return "z.string().datetime()";
|
|
@@ -164,34 +203,57 @@ const zodKeywordMapper = {
|
|
|
164
203
|
if (coercion) return "z.coerce.date()";
|
|
165
204
|
return "z.date()";
|
|
166
205
|
},
|
|
167
|
-
uuid: (coercion, version = "3", min, max) => {
|
|
206
|
+
uuid: (coercion, version = "3", min, max, mini) => {
|
|
207
|
+
if (mini) {
|
|
208
|
+
const checks = buildLengthChecks(min, max);
|
|
209
|
+
if (checks.length > 0) return `z.uuid().check(${checks.join(", ")})`;
|
|
210
|
+
return "z.uuid()";
|
|
211
|
+
}
|
|
168
212
|
return [
|
|
169
213
|
coercion ? version === "4" ? "z.uuid()" : "z.coerce.string().uuid()" : version === "4" ? "z.uuid()" : "z.string().uuid()",
|
|
170
214
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
171
215
|
max !== void 0 ? `.max(${max})` : void 0
|
|
172
216
|
].filter(Boolean).join("");
|
|
173
217
|
},
|
|
174
|
-
url: (coercion, version = "3", min, max) => {
|
|
218
|
+
url: (coercion, version = "3", min, max, mini) => {
|
|
219
|
+
if (mini) {
|
|
220
|
+
const checks = buildLengthChecks(min, max);
|
|
221
|
+
if (checks.length > 0) return `z.url().check(${checks.join(", ")})`;
|
|
222
|
+
return "z.url()";
|
|
223
|
+
}
|
|
175
224
|
return [
|
|
176
225
|
coercion ? version === "4" ? "z.url()" : "z.coerce.string().url()" : version === "4" ? "z.url()" : "z.string().url()",
|
|
177
226
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
178
227
|
max !== void 0 ? `.max(${max})` : void 0
|
|
179
228
|
].filter(Boolean).join("");
|
|
180
229
|
},
|
|
181
|
-
default: (value) => {
|
|
230
|
+
default: (value, innerSchema, mini) => {
|
|
231
|
+
if (mini && innerSchema) return `z._default(${innerSchema}, ${typeof value === "object" ? "{}" : value ?? ""})`;
|
|
182
232
|
if (typeof value === "object") return ".default({})";
|
|
183
233
|
return `.default(${value ?? ""})`;
|
|
184
234
|
},
|
|
185
235
|
and: (items = []) => items?.map((item) => `.and(${item})`).join(""),
|
|
186
|
-
describe: (value = "") =>
|
|
236
|
+
describe: (value = "", innerSchema, mini) => {
|
|
237
|
+
if (mini) return;
|
|
238
|
+
if (innerSchema) return `z.describe(${innerSchema}, ${value})`;
|
|
239
|
+
return `.describe(${value})`;
|
|
240
|
+
},
|
|
187
241
|
max: void 0,
|
|
188
242
|
min: void 0,
|
|
189
243
|
optional: (value) => {
|
|
190
244
|
if (value) return `z.optional(${value})`;
|
|
191
245
|
return ".optional()";
|
|
192
246
|
},
|
|
193
|
-
matches: (value = "", coercion) =>
|
|
194
|
-
|
|
247
|
+
matches: (value = "", coercion, mini) => {
|
|
248
|
+
if (mini) return `z.string().check(z.regex(${value}))`;
|
|
249
|
+
return coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`;
|
|
250
|
+
},
|
|
251
|
+
email: (coercion, version = "3", min, max, mini) => {
|
|
252
|
+
if (mini) {
|
|
253
|
+
const checks = buildLengthChecks(min, max);
|
|
254
|
+
if (checks.length > 0) return `z.email().check(${checks.join(", ")})`;
|
|
255
|
+
return "z.email()";
|
|
256
|
+
}
|
|
195
257
|
return [
|
|
196
258
|
coercion ? version === "4" ? "z.email()" : "z.coerce.string().email()" : version === "4" ? "z.email()" : "z.string().email()",
|
|
197
259
|
min !== void 0 ? `.min(${min})` : void 0,
|
|
@@ -212,7 +274,10 @@ const zodKeywordMapper = {
|
|
|
212
274
|
deprecated: void 0,
|
|
213
275
|
example: void 0,
|
|
214
276
|
schema: void 0,
|
|
215
|
-
catchall: (value) =>
|
|
277
|
+
catchall: (value, mini) => {
|
|
278
|
+
if (mini) return;
|
|
279
|
+
return value ? `.catchall(${value})` : void 0;
|
|
280
|
+
},
|
|
216
281
|
name: void 0,
|
|
217
282
|
exclusiveMinimum: void 0,
|
|
218
283
|
exclusiveMaximum: void 0
|
|
@@ -249,6 +314,55 @@ function sort(items) {
|
|
|
249
314
|
if (!items) return [];
|
|
250
315
|
return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ["asc"]);
|
|
251
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Keywords that represent modifiers for mini mode
|
|
319
|
+
* These are separated from the base schema and wrapped around it
|
|
320
|
+
* Note: describe is included to filter it out, but won't be wrapped (Zod Mini doesn't support describe)
|
|
321
|
+
*/
|
|
322
|
+
const miniModifierKeywords = [
|
|
323
|
+
schemaKeywords.optional,
|
|
324
|
+
schemaKeywords.nullable,
|
|
325
|
+
schemaKeywords.nullish,
|
|
326
|
+
schemaKeywords.default,
|
|
327
|
+
schemaKeywords.describe
|
|
328
|
+
];
|
|
329
|
+
/**
|
|
330
|
+
* Extracts mini mode modifiers from a schemas array
|
|
331
|
+
* This can be reused by other parsers (e.g., valibot) that need similar functionality
|
|
332
|
+
* Note: describe is not included as Zod Mini doesn't support it
|
|
333
|
+
*/
|
|
334
|
+
function extractMiniModifiers(schemas) {
|
|
335
|
+
const defaultSchema = schemas.find((item) => isKeyword(item, schemaKeywords.default));
|
|
336
|
+
return {
|
|
337
|
+
hasOptional: schemas.some((item) => isKeyword(item, schemaKeywords.optional)),
|
|
338
|
+
hasNullable: schemas.some((item) => isKeyword(item, schemaKeywords.nullable)),
|
|
339
|
+
hasNullish: schemas.some((item) => isKeyword(item, schemaKeywords.nullish)),
|
|
340
|
+
defaultValue: defaultSchema?.args
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Filters out modifier keywords from schemas for mini mode base schema parsing
|
|
345
|
+
* This can be reused by other parsers (e.g., valibot) that need similar functionality
|
|
346
|
+
*/
|
|
347
|
+
function filterMiniModifiers(schemas) {
|
|
348
|
+
return schemas.filter((item) => !miniModifierKeywords.some((keyword) => isKeyword(item, keyword)));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Wraps an output string with Zod Mini functional modifiers
|
|
352
|
+
* Order: default (innermost) -> nullable -> optional (outermost)
|
|
353
|
+
* OR: default -> nullish
|
|
354
|
+
* Note: describe is not supported in Zod Mini and is skipped
|
|
355
|
+
*/
|
|
356
|
+
function wrapWithMiniModifiers(output, modifiers) {
|
|
357
|
+
let result = output;
|
|
358
|
+
if (modifiers.defaultValue !== void 0) result = zodKeywordMapper.default(modifiers.defaultValue, result, true);
|
|
359
|
+
if (modifiers.hasNullish) result = zodKeywordMapper.nullish(result);
|
|
360
|
+
else {
|
|
361
|
+
if (modifiers.hasNullable) result = zodKeywordMapper.nullable(result);
|
|
362
|
+
if (modifiers.hasOptional) result = zodKeywordMapper.optional(result);
|
|
363
|
+
}
|
|
364
|
+
return result;
|
|
365
|
+
}
|
|
252
366
|
const shouldCoerce = (coercion, type) => {
|
|
253
367
|
if (coercion === void 0) return false;
|
|
254
368
|
if (typeof coercion === "boolean") return coercion;
|
|
@@ -297,7 +411,7 @@ function parse({ schema, parent, current, name, siblings }, options) {
|
|
|
297
411
|
current: it,
|
|
298
412
|
siblings: siblings$1
|
|
299
413
|
}, options);
|
|
300
|
-
}).filter(Boolean), current.args.min, current.args.max, current.args.unique);
|
|
414
|
+
}).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
|
|
301
415
|
if (isKeyword(current, schemaKeywords.enum)) {
|
|
302
416
|
if (current.args.asConst) {
|
|
303
417
|
if (current.args.items.length === 1) {
|
|
@@ -368,6 +482,20 @@ function parse({ schema, parent, current, name, siblings }, options) {
|
|
|
368
482
|
schema: schema?.properties?.[propertyName]
|
|
369
483
|
}) || baseSchemaOutput : baseSchemaOutput;
|
|
370
484
|
if (options.version === "4" && hasRef$1) {
|
|
485
|
+
if (options.mini) {
|
|
486
|
+
if (isNullish) return `get "${propertyName}"(){
|
|
487
|
+
return ${zodKeywordMapper.nullish(objectValue)}
|
|
488
|
+
}`;
|
|
489
|
+
if (isOptional) return `get "${propertyName}"(){
|
|
490
|
+
return ${zodKeywordMapper.optional(objectValue)}
|
|
491
|
+
}`;
|
|
492
|
+
if (isNullable) return `get "${propertyName}"(){
|
|
493
|
+
return ${zodKeywordMapper.nullable(objectValue)}
|
|
494
|
+
}`;
|
|
495
|
+
return `get "${propertyName}"(){
|
|
496
|
+
return ${objectValue}
|
|
497
|
+
}`;
|
|
498
|
+
}
|
|
371
499
|
if (isNullish) return `get "${propertyName}"(){
|
|
372
500
|
return ${objectValue}${zodKeywordMapper.nullish()}
|
|
373
501
|
}`;
|
|
@@ -393,7 +521,7 @@ function parse({ schema, parent, current, name, siblings }, options) {
|
|
|
393
521
|
current: it,
|
|
394
522
|
siblings: siblings$1
|
|
395
523
|
}, options)).filter(Boolean).join("") : void 0;
|
|
396
|
-
return [zodKeywordMapper.object(properties, current.args?.strict, options.version), additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : void 0].filter(Boolean).join("");
|
|
524
|
+
return [zodKeywordMapper.object(properties, current.args?.strict, options.version), additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : void 0].filter(Boolean).join("");
|
|
397
525
|
}
|
|
398
526
|
if (isKeyword(current, schemaKeywords.tuple)) return zodKeywordMapper.tuple(current.args.items.map((it, _index, siblings$1) => parse({
|
|
399
527
|
schema,
|
|
@@ -408,45 +536,50 @@ function parse({ schema, parent, current, name, siblings }, options) {
|
|
|
408
536
|
return zodKeywordMapper.const(transformers.stringify(current.args.value));
|
|
409
537
|
}
|
|
410
538
|
if (isKeyword(current, schemaKeywords.matches)) {
|
|
411
|
-
if (current.args) return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, "strings"));
|
|
539
|
+
if (current.args) return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, "strings"), options.mini);
|
|
412
540
|
}
|
|
413
541
|
if (isKeyword(current, schemaKeywords.default)) {
|
|
542
|
+
if (options.mini) return;
|
|
414
543
|
if (current.args) return zodKeywordMapper.default(current.args);
|
|
415
544
|
}
|
|
416
545
|
if (isKeyword(current, schemaKeywords.describe)) {
|
|
417
|
-
if (current.args) return zodKeywordMapper.describe(transformers.stringify(current.args.toString()));
|
|
546
|
+
if (current.args) return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), void 0, options.mini);
|
|
418
547
|
}
|
|
419
548
|
if (isKeyword(current, schemaKeywords.string)) {
|
|
420
549
|
const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
|
|
421
550
|
const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
|
|
422
|
-
return zodKeywordMapper.string(shouldCoerce(options.coercion, "strings"), minSchema?.args, maxSchema?.args);
|
|
551
|
+
return zodKeywordMapper.string(shouldCoerce(options.coercion, "strings"), minSchema?.args, maxSchema?.args, options.mini);
|
|
552
|
+
}
|
|
553
|
+
if (isKeyword(current, schemaKeywords.uuid)) {
|
|
554
|
+
const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
|
|
555
|
+
const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
|
|
556
|
+
return zodKeywordMapper.uuid(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
423
557
|
}
|
|
424
|
-
if (isKeyword(current, schemaKeywords.uuid)) return zodKeywordMapper.uuid(shouldCoerce(options.coercion, "strings"), options.version);
|
|
425
558
|
if (isKeyword(current, schemaKeywords.email)) {
|
|
426
559
|
const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
|
|
427
560
|
const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
|
|
428
|
-
return zodKeywordMapper.email(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args);
|
|
561
|
+
return zodKeywordMapper.email(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
429
562
|
}
|
|
430
563
|
if (isKeyword(current, schemaKeywords.url)) {
|
|
431
564
|
const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
|
|
432
565
|
const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
|
|
433
|
-
return zodKeywordMapper.url(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args);
|
|
566
|
+
return zodKeywordMapper.url(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
434
567
|
}
|
|
435
568
|
if (isKeyword(current, schemaKeywords.number)) {
|
|
436
569
|
const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
|
|
437
570
|
const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
|
|
438
571
|
const exclusiveMinimumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMinimum);
|
|
439
572
|
const exclusiveMaximumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMaximum);
|
|
440
|
-
return zodKeywordMapper.number(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args);
|
|
573
|
+
return zodKeywordMapper.number(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
|
|
441
574
|
}
|
|
442
575
|
if (isKeyword(current, schemaKeywords.integer)) {
|
|
443
576
|
const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
|
|
444
577
|
const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
|
|
445
578
|
const exclusiveMinimumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMinimum);
|
|
446
579
|
const exclusiveMaximumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMaximum);
|
|
447
|
-
return zodKeywordMapper.integer(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, options.version, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args);
|
|
580
|
+
return zodKeywordMapper.integer(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, options.version, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
|
|
448
581
|
}
|
|
449
|
-
if (isKeyword(current, schemaKeywords.datetime)) return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version);
|
|
582
|
+
if (isKeyword(current, schemaKeywords.datetime)) return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini);
|
|
450
583
|
if (isKeyword(current, schemaKeywords.date)) return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
|
|
451
584
|
if (isKeyword(current, schemaKeywords.time)) return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
|
|
452
585
|
if (current.keyword in zodKeywordMapper && "args" in current) {
|
|
@@ -458,14 +591,15 @@ function parse({ schema, parent, current, name, siblings }, options) {
|
|
|
458
591
|
|
|
459
592
|
//#endregion
|
|
460
593
|
//#region src/components/Zod.tsx
|
|
461
|
-
function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, keysToOmit, description, wrapOutput, version, emptySchemaType }) {
|
|
594
|
+
function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, keysToOmit, description, wrapOutput, version, emptySchemaType, mini = false }) {
|
|
462
595
|
const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple);
|
|
463
596
|
const schemas = sort(tree).filter((item) => {
|
|
464
597
|
if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) return false;
|
|
465
598
|
return true;
|
|
466
599
|
});
|
|
467
|
-
const
|
|
468
|
-
|
|
600
|
+
const baseSchemas = mini ? filterMiniModifiers(schemas) : schemas;
|
|
601
|
+
const output = baseSchemas.map((schema$1, index) => {
|
|
602
|
+
const siblings = baseSchemas.filter((_, i) => i !== index);
|
|
469
603
|
return parse({
|
|
470
604
|
schema: schema$1,
|
|
471
605
|
parent: void 0,
|
|
@@ -476,17 +610,20 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
476
610
|
mapper,
|
|
477
611
|
coercion,
|
|
478
612
|
wrapOutput,
|
|
479
|
-
version
|
|
613
|
+
version,
|
|
614
|
+
mini
|
|
480
615
|
});
|
|
481
616
|
}).filter(Boolean).join("");
|
|
482
617
|
let suffix = "";
|
|
483
618
|
const firstSchema = schemas.at(0);
|
|
484
619
|
const lastSchema = schemas.at(-1);
|
|
485
|
-
if (lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) if (version === "3") suffix = ".unwrap().schema.unwrap()";
|
|
620
|
+
if (!mini && lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) if (version === "3") suffix = ".unwrap().schema.unwrap()";
|
|
486
621
|
else suffix = ".unwrap().unwrap()";
|
|
487
622
|
else suffix = ".unwrap()";
|
|
488
|
-
else if (
|
|
489
|
-
|
|
623
|
+
else if (!mini) {
|
|
624
|
+
if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) if (version === "3") suffix = ".schema";
|
|
625
|
+
else suffix = ".unwrap()";
|
|
626
|
+
}
|
|
490
627
|
const emptyValue = parse({
|
|
491
628
|
schema,
|
|
492
629
|
parent: void 0,
|
|
@@ -496,9 +633,11 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
496
633
|
mapper,
|
|
497
634
|
coercion,
|
|
498
635
|
wrapOutput,
|
|
499
|
-
version
|
|
636
|
+
version,
|
|
637
|
+
mini
|
|
500
638
|
});
|
|
501
|
-
|
|
639
|
+
let baseSchemaOutput = [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(",")} })` : void 0].filter(Boolean).join("") || emptyValue || "";
|
|
640
|
+
if (mini) baseSchemaOutput = wrapWithMiniModifiers(baseSchemaOutput, extractMiniModifiers(schemas));
|
|
502
641
|
const wrappedSchemaOutput = wrapOutput ? wrapOutput({
|
|
503
642
|
output: baseSchemaOutput,
|
|
504
643
|
schema
|
|
@@ -533,4 +672,4 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
533
672
|
|
|
534
673
|
//#endregion
|
|
535
674
|
export { Operations as n, Zod as t };
|
|
536
|
-
//# sourceMappingURL=components-
|
|
675
|
+
//# sourceMappingURL=components-DhgOJ6ja.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-DhgOJ6ja.js","names":["checks: string[]","order: string[]","schema","hasRef","value","parserZod.sort","parserZod.filterMiniModifiers","parserZod.parse","schema","parserZod.wrapWithMiniModifiers","parserZod.extractMiniModifiers"],"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbNode {\n const operationsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.getOperationId()}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.path}\"`] = {\n ...(prev[`\"${acc.operation.path}\"`] || ({} as Record<HttpMethod, string>)),\n [acc.operation.method]: `operations[\"${acc.operation.getOperationId()}\"]`,\n }\n\n return prev\n },\n {} as Record<string, Record<HttpMethod, string>>,\n )\n\n return (\n <>\n <File.Source name=\"OperationSchema\" isExportable isIndexable>\n <Type name=\"OperationSchema\" export>{`{\n readonly request: z.ZodTypeAny | undefined;\n readonly parameters: {\n readonly path: z.ZodTypeAny | undefined;\n readonly query: z.ZodTypeAny | undefined;\n readonly header: z.ZodTypeAny | undefined;\n };\n readonly responses: {\n readonly [status: number]: z.ZodTypeAny;\n readonly default: z.ZodTypeAny;\n };\n readonly errors: {\n readonly [status: number]: z.ZodTypeAny;\n };\n}`}</Type>\n </File.Source>\n <File.Source name=\"OperationsMap\" isExportable isIndexable>\n <Type name=\"OperationsMap\" export>\n {'Record<string, OperationSchema>'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} asConst>\n {`{${transformers.stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${transformers.stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import transformers from '@kubb/core/transformers'\n\nimport type { Schema, SchemaKeywordBase, SchemaMapper } from '@kubb/plugin-oas'\nimport { isKeyword, SchemaGenerator, type SchemaKeywordMapper, type SchemaTree, schemaKeywords } from '@kubb/plugin-oas'\n\n//TODO add zodKeywordMapper as function that returns 3 versions: v3, v4 and v4 mini, this can also be used to have the custom mapping(see object type)\n// also include shouldCoerce\n\n/**\n * Helper to build string/array length constraint checks for Zod Mini mode\n */\nfunction buildLengthChecks(min?: number, max?: number): string[] {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n return checks\n}\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number, exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minimum(${min})`)\n if (max !== undefined) checks.push(`z.maximum(${max})`)\n if (exclusiveMinimum !== undefined) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`)\n if (exclusiveMaximum !== undefined) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`)\n if (checks.length > 0) {\n return `z.number().check(${checks.join(', ')})`\n }\n return 'z.number()'\n }\n return [\n coercion ? 'z.coerce.number()' : 'z.number()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number, version: '3' | '4' = '3', exclusiveMinimum?: number, exclusiveMaximum?: number, mini?: boolean) => {\n if (mini) {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minimum(${min})`)\n if (max !== undefined) checks.push(`z.maximum(${max})`)\n if (exclusiveMinimum !== undefined) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`)\n if (exclusiveMaximum !== undefined) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`)\n if (checks.length > 0) {\n return `z.int().check(${checks.join(', ')})`\n }\n return 'z.int()'\n }\n return [\n coercion ? 'z.coerce.number().int()' : version === '4' ? 'z.int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : undefined,\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n interface: (value?: string, strict?: boolean) => {\n if (strict) {\n return `z.strictInterface({\n ${value}\n })`\n }\n return `z.interface({\n ${value}\n })`\n },\n object: (value?: string, strict?: boolean, version: '3' | '4' = '3') => {\n if (version === '4' && strict) {\n return `z.strictObject({\n ${value}\n })`\n }\n\n if (strict) {\n return `z.object({\n ${value}\n }).strict()`\n }\n\n return `z.object({\n ${value}\n })`\n },\n string: (coercion?: boolean, min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.string().check(${checks.join(', ')})`\n }\n return 'z.string()'\n }\n return [coercion ? 'z.coerce.string()' : 'z.string()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n //support for discriminatedUnion\n boolean: () => 'z.boolean()',\n undefined: () => 'z.undefined()',\n nullable: (value?: string) => {\n if (value) {\n return `z.nullable(${value})`\n }\n return '.nullable()'\n },\n null: () => 'z.null()',\n nullish: (value?: string) => {\n if (value) {\n return `z.nullish(${value})`\n }\n return '.nullish()'\n },\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (unique) checks.push(`z.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`)\n if (checks.length > 0) {\n return `z.array(${items?.join('')}).check(${checks.join(', ')})`\n }\n return `z.array(${items?.join('')})`\n }\n return [\n `z.array(${items?.join('')})`,\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n unique ? `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n tuple: (items: string[] = []) => `z.tuple([${items?.join(', ')}])`,\n enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`,\n union: (items: string[] = []) => `z.union([${items?.join(', ')}])`,\n const: (value?: string | number | boolean) => `z.literal(${value ?? ''})`,\n /**\n * ISO 8601\n */\n datetime: (offset = false, local = false, version: '3' | '4' = '3', mini?: boolean) => {\n // Zod Mini doesn't support .datetime() method, use plain string\n if (mini) {\n return 'z.string()'\n }\n\n if (offset) {\n return version === '4' ? `z.iso.datetime({ offset: ${offset} })` : `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return version === '4' ? `z.iso.datetime({ local: ${local} })` : `z.string().datetime({ local: ${local} })`\n }\n\n return 'z.string().datetime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.date()' : 'z.string().date()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', coercion?: boolean, version: '3' | '4' = '3') => {\n if (type === 'string') {\n return version === '4' ? 'z.iso.time()' : 'z.string().time()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n uuid: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.uuid().check(${checks.join(', ')})`\n }\n return 'z.uuid()'\n }\n return [\n coercion ? (version === '4' ? 'z.uuid()' : 'z.coerce.string().uuid()') : version === '4' ? 'z.uuid()' : 'z.string().uuid()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n url: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.url().check(${checks.join(', ')})`\n }\n return 'z.url()'\n }\n return [\n coercion ? (version === '4' ? 'z.url()' : 'z.coerce.string().url()') : version === '4' ? 'z.url()' : 'z.string().url()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n default: (value?: string | number | true | object, innerSchema?: string, mini?: boolean) => {\n if (mini && innerSchema) {\n const defaultValue = typeof value === 'object' ? '{}' : (value ?? '')\n return `z._default(${innerSchema}, ${defaultValue})`\n }\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 = '', innerSchema?: string, mini?: boolean) => {\n if (mini) {\n return undefined\n }\n\n if (innerSchema) {\n return `z.describe(${innerSchema}, ${value})`\n }\n return `.describe(${value})`\n },\n max: undefined,\n min: undefined,\n optional: (value?: string) => {\n if (value) {\n return `z.optional(${value})`\n }\n return '.optional()'\n },\n matches: (value = '', coercion?: boolean, mini?: boolean) => {\n if (mini) {\n return `z.string().check(z.regex(${value}))`\n }\n return coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`\n },\n email: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number, mini?: boolean) => {\n if (mini) {\n const checks = buildLengthChecks(min, max)\n if (checks.length > 0) {\n return `z.email().check(${checks.join(', ')})`\n }\n return 'z.email()'\n }\n return [\n coercion ? (version === '4' ? 'z.email()' : 'z.coerce.string().email()') : version === '4' ? 'z.email()' : 'z.string().email()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (value?: string) => {\n if (!value) {\n return undefined\n }\n\n return `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string, mini?: boolean) => {\n // Zod Mini doesn't support .catchall() method\n if (mini) {\n return undefined\n }\n return value ? `.catchall(${value})` : undefined\n },\n name: undefined,\n exclusiveMinimum: undefined,\n exclusiveMaximum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nexport function sort(items?: Schema[]): Schema[] {\n const order: string[] = [\n schemaKeywords.string,\n schemaKeywords.datetime,\n schemaKeywords.date,\n schemaKeywords.time,\n schemaKeywords.tuple,\n schemaKeywords.number,\n schemaKeywords.object,\n schemaKeywords.enum,\n schemaKeywords.url,\n schemaKeywords.email,\n schemaKeywords.firstName,\n schemaKeywords.lastName,\n schemaKeywords.password,\n schemaKeywords.matches,\n schemaKeywords.uuid,\n schemaKeywords.null,\n schemaKeywords.min,\n schemaKeywords.max,\n schemaKeywords.default,\n schemaKeywords.describe,\n schemaKeywords.optional,\n schemaKeywords.nullable,\n schemaKeywords.nullish,\n ]\n\n if (!items) {\n return []\n }\n\n return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ['asc'])\n}\n\ntype MiniModifiers = {\n hasOptional?: boolean\n hasNullable?: boolean\n hasNullish?: boolean\n defaultValue?: string | number | true | object\n}\n\n/**\n * Keywords that represent modifiers for mini mode\n * These are separated from the base schema and wrapped around it\n * Note: describe is included to filter it out, but won't be wrapped (Zod Mini doesn't support describe)\n */\nexport const miniModifierKeywords = [schemaKeywords.optional, schemaKeywords.nullable, schemaKeywords.nullish, schemaKeywords.default, schemaKeywords.describe]\n\n/**\n * Extracts mini mode modifiers from a schemas array\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n * Note: describe is not included as Zod Mini doesn't support it\n */\nexport function extractMiniModifiers(schemas: Schema[]): MiniModifiers {\n const defaultSchema = schemas.find((item) => isKeyword(item, schemaKeywords.default)) as { keyword: string; args: unknown } | undefined\n\n return {\n hasOptional: schemas.some((item) => isKeyword(item, schemaKeywords.optional)),\n hasNullable: schemas.some((item) => isKeyword(item, schemaKeywords.nullable)),\n hasNullish: schemas.some((item) => isKeyword(item, schemaKeywords.nullish)),\n defaultValue: defaultSchema?.args as string | number | true | object | undefined,\n }\n}\n\n/**\n * Filters out modifier keywords from schemas for mini mode base schema parsing\n * This can be reused by other parsers (e.g., valibot) that need similar functionality\n */\nexport function filterMiniModifiers(schemas: Schema[]): Schema[] {\n return schemas.filter((item) => !miniModifierKeywords.some((keyword) => isKeyword(item, keyword)))\n}\n\n/**\n * Wraps an output string with Zod Mini functional modifiers\n * Order: default (innermost) -> nullable -> optional (outermost)\n * OR: default -> nullish\n * Note: describe is not supported in Zod Mini and is skipped\n */\nexport function wrapWithMiniModifiers(output: string, modifiers: MiniModifiers): string {\n let result = output\n\n // Apply default first (innermost wrapper)\n if (modifiers.defaultValue !== undefined) {\n result = zodKeywordMapper.default(modifiers.defaultValue, result, true)!\n }\n\n // Apply nullish, nullable, or optional (outer wrappers for optionality)\n if (modifiers.hasNullish) {\n result = zodKeywordMapper.nullish(result)!\n } else {\n if (modifiers.hasNullable) {\n result = zodKeywordMapper.nullable(result)!\n }\n if (modifiers.hasOptional) {\n result = zodKeywordMapper.optional(result)!\n }\n }\n\n return result\n}\n\nconst shouldCoerce = (coercion: ParserOptions['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean => {\n if (coercion === undefined) {\n return false\n }\n if (typeof coercion === 'boolean') {\n return coercion\n }\n\n return !!coercion[type]\n}\n\ntype ParserOptions = {\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n version: '3' | '4'\n skipLazyForRefs?: boolean\n mini?: boolean\n}\n\nexport function parse({ schema, parent, current, name, siblings }: SchemaTree, options: ParserOptions): string | undefined {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper]\n\n // Early exit: if siblings contain both matches and ref → skip matches entirely\n const hasMatches = siblings.some((it) => isKeyword(it, schemaKeywords.matches))\n const hasRef = siblings.some((it) => isKeyword(it, schemaKeywords.ref))\n\n if (hasMatches && hasRef && isKeyword(current, schemaKeywords.matches)) {\n return undefined // strip matches\n }\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({ schema, parent, name, current: current.args[0] as Schema, siblings }, options)\n }\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return zodKeywordMapper.union(\n sort(current.args)\n .map((it, _index, siblings) => parse({ schema, parent: current, name, current: it, 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((it: Schema, _index, siblings) => parse({ schema, parent: current, name, current: it, 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((it, _index, siblings) => {\n return parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n options.mini,\n )\n }\n\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({ schema, parent: current, name, current: child, siblings: [child] }, options)\n }\n\n return zodKeywordMapper.union(\n current.args.items\n .map((schema) => ({\n keyword: schemaKeywords.const,\n args: schema,\n }))\n .map((it, _index, siblings) => {\n return parse({ schema, parent: current, name, current: it, siblings }, options)\n })\n .filter(Boolean),\n )\n }\n\n return zodKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'boolean') {\n return transformers.stringify(schema.value)\n }\n\n if (schema.format === 'number') {\n return transformers.stringify(schema.value)\n }\n return transformers.stringify(schema.value)\n }),\n )\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n // Skip z.lazy wrapper if skipLazyForRefs is true (e.g., inside v4 getters)\n if (options.skipLazyForRefs) {\n return current.args?.name\n }\n return zodKeywordMapper.ref(current.args?.name)\n }\n\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 properties = propertyEntries\n .map(([propertyName, schemas]) => {\n const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable))\n const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish))\n const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional))\n const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref)\n\n const mappedName = nameSchema?.args || propertyName\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return `\"${propertyName}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .filter((schema) => {\n return !isKeyword(schema, schemaKeywords.optional) && !isKeyword(schema, schemaKeywords.nullable) && !isKeyword(schema, schemaKeywords.nullish)\n })\n .map((it) => {\n // For v4 with refs, skip z.lazy wrapper since the getter provides lazy evaluation\n const skipLazyForRefs = options.version === '4' && hasRef\n return parse({ schema, parent: current, name, current: it, siblings: schemas }, { ...options, skipLazyForRefs })\n })\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: schema?.properties?.[propertyName] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (options.version === '4' && hasRef) {\n // In mini mode, use functional wrappers instead of chainable methods\n if (options.mini) {\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullish(objectValue)}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.optional(objectValue)}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${zodKeywordMapper.nullable(objectValue)}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // Non-mini mode uses chainable methods\n // both optional and nullable\n if (isNullish) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullish()}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.optional()}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${propertyName}\"(){\n return ${objectValue}${zodKeywordMapper.nullable()}\n }`\n }\n\n return `get \"${propertyName}\"(){\n return ${objectValue}\n }`\n }\n\n // both optional and nullable\n if (isNullish) {\n return `\"${propertyName}\": ${objectValue}${zodKeywordMapper.nullish()}`\n }\n\n // undefined\n if (isOptional) {\n return `\"${propertyName}\": ${zodKeywordMapper.optional(objectValue)}`\n }\n\n // null\n if (isNullable) {\n return `\"${propertyName}\": ${zodKeywordMapper.nullable(objectValue)}`\n }\n\n return `\"${propertyName}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((it, _index, siblings) => parse({ schema, parent: current, name, current: it, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n zodKeywordMapper.object(properties, current.args?.strict, options.version),\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return zodKeywordMapper.tuple(\n current.args.items.map((it, _index, siblings) => parse({ schema, parent: current, name, current: it, 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(current.args.value))\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'), options.mini)\n }\n }\n\n if (isKeyword(current, schemaKeywords.default)) {\n // In mini mode, default is handled by wrapWithMiniModifiers\n if (options.mini) {\n return undefined\n }\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()), undefined, options.mini)\n }\n }\n\n if (isKeyword(current, schemaKeywords.string)) {\n const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min)\n const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max)\n\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'), minSchema?.args, maxSchema?.args, options.mini)\n }\n\n if (isKeyword(current, schemaKeywords.uuid)) {\n const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min)\n const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max)\n\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n }\n\n if (isKeyword(current, schemaKeywords.email)) {\n const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min)\n const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max)\n\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n }\n\n if (isKeyword(current, schemaKeywords.url)) {\n const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min)\n const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max)\n\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'), options.version, minSchema?.args, maxSchema?.args, options.mini)\n }\n\n if (isKeyword(current, schemaKeywords.number)) {\n const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min)\n const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max)\n\n const exclusiveMinimumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMinimum)\n const exclusiveMaximumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMaximum)\n return zodKeywordMapper.number(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n }\n\n if (isKeyword(current, schemaKeywords.integer)) {\n const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min)\n const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max)\n\n const exclusiveMinimumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMinimum)\n const exclusiveMaximumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMaximum)\n return zodKeywordMapper.integer(\n shouldCoerce(options.coercion, 'numbers'),\n minSchema?.args,\n maxSchema?.args,\n options.version,\n exclusiveMinimumSchema?.args,\n exclusiveMaximumSchema?.args,\n options.mini,\n )\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini)\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'), options.version)\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 (current.keyword in zodKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n schema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n version: '3' | '4'\n emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType']\n mini?: boolean\n}\n\nexport function Zod({\n name,\n typeName,\n tree,\n schema,\n inferTypeName,\n mapper,\n coercion,\n keysToOmit,\n description,\n wrapOutput,\n version,\n emptySchemaType,\n mini = false,\n}: Props): KubbNode {\n const hasTuple = !!SchemaGenerator.find(tree, schemaKeywords.tuple)\n\n const schemas = parserZod.sort(tree).filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n\n // In mini mode, filter out modifiers from the main schema parsing\n const baseSchemas = mini ? parserZod.filterMiniModifiers(schemas) : schemas\n\n const output = baseSchemas\n .map((schema, index) => {\n const siblings = baseSchemas.filter((_, i) => i !== index)\n\n return parserZod.parse({ schema, parent: undefined, current: schema, siblings, name }, { mapper, coercion, wrapOutput, version, mini })\n })\n .filter(Boolean)\n .join('')\n\n let suffix = ''\n const firstSchema = schemas.at(0)\n const lastSchema = schemas.at(-1)\n\n if (!mini && lastSchema && isKeyword(lastSchema, schemaKeywords.nullable)) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.unwrap().schema.unwrap()'\n } else {\n suffix = '.unwrap().unwrap()'\n }\n } else {\n suffix = '.unwrap()'\n }\n } else if (!mini) {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref)) {\n if (version === '3') {\n suffix = '.schema'\n } else {\n suffix = '.unwrap()'\n }\n }\n }\n\n const emptyValue = parserZod.parse(\n {\n schema,\n parent: undefined,\n current: {\n keyword: schemaKeywords[emptySchemaType],\n },\n siblings: [],\n },\n { mapper, coercion, wrapOutput, version, mini },\n )\n\n let baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n emptyValue ||\n ''\n\n // For mini mode, wrap the output with modifiers using the parser function\n if (mini) {\n baseSchemaOutput = parserZod.wrapWithMiniModifiers(baseSchemaOutput, parserZod.extractMiniModifiers(schemas))\n }\n\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ${version === '4' ? 'z.ZodType' : 'ToZod'}<${typeName}>` : wrappedSchemaOutput\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const\n export\n name={name}\n JSDoc={{\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }}\n >\n {finalOutput}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n {typeName && (\n <Type export name={inferTypeName}>\n {typeName}\n </Type>\n )}\n {!typeName && (\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n )}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;AAWA,SAAgB,WAAW,EAAE,MAAM,cAA+B;CAChE,MAAM,iBAAiB,WAAW,QAC/B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,gBAAgB,CAAC,MAAM,IAAI;AAElD,SAAO;IAET,EAAE,CACH;CAED,MAAM,YAA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kB;EAAQ,CAAC,IAAI,mBAAmB;CAChH,MAAM,cAAc,WAAW,GAAG,oBAAoB,iBAAiB,YAAY,MAAM,cAAc,QAAQ,GAAG,SAAS,KAAK;AAEhI,QACE,8CACE,oBAAC,KAAK;EAAa;EAAM;EAAa;YACpC,oBAAC;GACC;GACM;GACN,OAAO,EACL,UAAU,CAAC,cAAc,gBAAgB,aAAa,eAAe,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ,EACjH;aAEA;IACK;GACI,EACb,iBACC,qBAAC,KAAK;EAAO,MAAM;EAAe;EAAa;EAAY;aACxD,YACC,oBAAC;GAAK;GAAO,MAAM;aAChB;IACI,EAER,CAAC,YACA,oBAAC;GAAK;GAAO,MAAM;aAChB,kBAAkB,KAAK;IACnB;GAEG,IAEf"}
|
package/dist/components.cjs
CHANGED
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-
|
|
1
|
+
import { i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-DX8evdsR.cjs";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
@@ -44,6 +44,7 @@ type Props = {
|
|
|
44
44
|
wrapOutput?: PluginZod['resolvedOptions']['wrapOutput'];
|
|
45
45
|
version: '3' | '4';
|
|
46
46
|
emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType'];
|
|
47
|
+
mini?: boolean;
|
|
47
48
|
};
|
|
48
49
|
declare function Zod({
|
|
49
50
|
name,
|
|
@@ -57,7 +58,8 @@ declare function Zod({
|
|
|
57
58
|
description,
|
|
58
59
|
wrapOutput,
|
|
59
60
|
version,
|
|
60
|
-
emptySchemaType
|
|
61
|
+
emptySchemaType,
|
|
62
|
+
mini
|
|
61
63
|
}: Props): KubbNode;
|
|
62
64
|
//#endregion
|
|
63
65
|
export { Operations, Zod };
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-
|
|
1
|
+
import { i as Schema, n as PluginZod, o as Operation, s as SchemaObject } from "./types-COTxGHzo.js";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
@@ -44,6 +44,7 @@ type Props = {
|
|
|
44
44
|
wrapOutput?: PluginZod['resolvedOptions']['wrapOutput'];
|
|
45
45
|
version: '3' | '4';
|
|
46
46
|
emptySchemaType: PluginZod['resolvedOptions']['emptySchemaType'];
|
|
47
|
+
mini?: boolean;
|
|
47
48
|
};
|
|
48
49
|
declare function Zod({
|
|
49
50
|
name,
|
|
@@ -57,7 +58,8 @@ declare function Zod({
|
|
|
57
58
|
description,
|
|
58
59
|
wrapOutput,
|
|
59
60
|
version,
|
|
60
|
-
emptySchemaType
|
|
61
|
+
emptySchemaType,
|
|
62
|
+
mini
|
|
61
63
|
}: Props): KubbNode;
|
|
62
64
|
//#endregion
|
|
63
65
|
export { Operations, Zod };
|
package/dist/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Operations, t as Zod } from "./components-
|
|
1
|
+
import { n as Operations, t as Zod } from "./components-DhgOJ6ja.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { SchemaGenerator, schemaKeywords } from "@kubb/plugin-oas";
|
|
4
4
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
@@ -73,7 +73,7 @@ const operationsGenerator = createReactGenerator({
|
|
|
73
73
|
const zodGenerator = createReactGenerator({
|
|
74
74
|
name: "zod",
|
|
75
75
|
Operation({ config, operation, generator, plugin }) {
|
|
76
|
-
const { options, options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version } } = plugin;
|
|
76
|
+
const { options, options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version, mini } } = plugin;
|
|
77
77
|
const mode = useMode();
|
|
78
78
|
const pluginManager = usePluginManager();
|
|
79
79
|
const oas = useOas();
|
|
@@ -161,7 +161,8 @@ const zodGenerator = createReactGenerator({
|
|
|
161
161
|
keysToOmit,
|
|
162
162
|
wrapOutput,
|
|
163
163
|
version: plugin.options.version,
|
|
164
|
-
emptySchemaType: plugin.options.emptySchemaType
|
|
164
|
+
emptySchemaType: plugin.options.emptySchemaType,
|
|
165
|
+
mini
|
|
165
166
|
})
|
|
166
167
|
] });
|
|
167
168
|
};
|
|
@@ -186,7 +187,7 @@ const zodGenerator = createReactGenerator({
|
|
|
186
187
|
},
|
|
187
188
|
Schema({ config, schema, plugin }) {
|
|
188
189
|
const { getName, getFile, getImports } = useSchemaManager();
|
|
189
|
-
const { options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version } } = plugin;
|
|
190
|
+
const { options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, mini } } = plugin;
|
|
190
191
|
const pluginManager = usePluginManager();
|
|
191
192
|
const oas = useOas();
|
|
192
193
|
const imports = getImports(schema.tree);
|
|
@@ -251,7 +252,8 @@ const zodGenerator = createReactGenerator({
|
|
|
251
252
|
coercion,
|
|
252
253
|
wrapOutput,
|
|
253
254
|
version,
|
|
254
|
-
emptySchemaType
|
|
255
|
+
emptySchemaType,
|
|
256
|
+
mini
|
|
255
257
|
})
|
|
256
258
|
]
|
|
257
259
|
});
|
|
@@ -260,4 +262,4 @@ const zodGenerator = createReactGenerator({
|
|
|
260
262
|
|
|
261
263
|
//#endregion
|
|
262
264
|
export { operationsGenerator as n, zodGenerator as t };
|
|
263
|
-
//# sourceMappingURL=generators-
|
|
265
|
+
//# sourceMappingURL=generators-BUP3Ksen.js.map
|