@forklaunch/validator 0.7.6 → 0.7.7

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.
@@ -58,46 +58,626 @@ __export(zod_exports, {
58
58
  module.exports = __toCommonJS(zod_exports);
59
59
 
60
60
  // src/zod/zodSchemaValidator.ts
61
- var import_zod_openapi = require("@anatine/zod-openapi");
62
- var import_zod = require("zod");
63
- (0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
61
+ var import_v32 = require("zod/v3");
62
+
63
+ // shims/zod-v3-openapi/zod-openapi.ts
64
+ var import_ts_deepmerge = require("ts-deepmerge");
65
+ var import_v3 = require("zod/v3");
66
+ function extendApi(schema, schemaObject = {}) {
67
+ const This = schema.constructor;
68
+ const newSchema = new This(schema._def);
69
+ newSchema.metaOpenApi = Object.assign(
70
+ {},
71
+ schema.metaOpenApi || {},
72
+ schemaObject
73
+ );
74
+ return newSchema;
75
+ }
76
+ function iterateZodObject({
77
+ zodRef,
78
+ useOutput,
79
+ hideDefinitions,
80
+ openApiVersion
81
+ }) {
82
+ const reduced = Object.keys(zodRef.shape).filter((key) => hideDefinitions?.includes(key) === false).reduce(
83
+ (carry, key) => ({
84
+ ...carry,
85
+ [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
86
+ }),
87
+ {}
88
+ );
89
+ return reduced;
90
+ }
91
+ function typeFormat(type2, openApiVersion) {
92
+ return openApiVersion === "3.0" ? type2 : [type2];
93
+ }
94
+ function parseTransformation({
95
+ zodRef,
96
+ schemas,
97
+ useOutput,
98
+ openApiVersion
99
+ }) {
100
+ const input = generateSchema(zodRef._def.schema, useOutput, openApiVersion);
101
+ let output = "undefined";
102
+ if (useOutput && zodRef._def.effect) {
103
+ const effect = zodRef._def.effect.type === "transform" ? zodRef._def.effect : null;
104
+ if (effect && "transform" in effect) {
105
+ try {
106
+ const type2 = Array.isArray(input.type) ? input.type[0] : input.type;
107
+ output = typeof effect.transform(
108
+ ["integer", "number"].includes(`${type2}`) ? 0 : "string" === type2 ? "" : "boolean" === type2 ? false : "object" === type2 ? {} : "null" === type2 ? null : "array" === type2 ? [] : void 0,
109
+ { addIssue: () => void 0, path: [] }
110
+ // TODO: Discover if context is necessary here
111
+ );
112
+ } catch {
113
+ }
114
+ }
115
+ }
116
+ const outputType = output;
117
+ return (0, import_ts_deepmerge.merge)(
118
+ {
119
+ ...zodRef.description ? { description: zodRef.description } : {},
120
+ ...input,
121
+ ...["number", "string", "boolean", "null"].includes(output) ? {
122
+ type: typeFormat(outputType, openApiVersion)
123
+ } : {}
124
+ },
125
+ ...schemas
126
+ );
127
+ }
128
+ function parseString({
129
+ zodRef,
130
+ schemas,
131
+ openApiVersion
132
+ }) {
133
+ const baseSchema = {
134
+ type: typeFormat("string", openApiVersion)
135
+ };
136
+ const { checks = [] } = zodRef._def;
137
+ checks.forEach((item) => {
138
+ switch (item.kind) {
139
+ case "email":
140
+ baseSchema.format = "email";
141
+ break;
142
+ case "uuid":
143
+ baseSchema.format = "uuid";
144
+ break;
145
+ case "cuid":
146
+ baseSchema.format = "cuid";
147
+ break;
148
+ case "url":
149
+ baseSchema.format = "uri";
150
+ break;
151
+ case "datetime":
152
+ baseSchema.format = "date-time";
153
+ break;
154
+ case "length":
155
+ baseSchema.minLength = item.value;
156
+ baseSchema.maxLength = item.value;
157
+ break;
158
+ case "max":
159
+ baseSchema.maxLength = item.value;
160
+ break;
161
+ case "min":
162
+ baseSchema.minLength = item.value;
163
+ break;
164
+ case "regex":
165
+ baseSchema.pattern = item.regex.source;
166
+ break;
167
+ }
168
+ });
169
+ return (0, import_ts_deepmerge.merge)(
170
+ baseSchema,
171
+ zodRef.description ? { description: zodRef.description } : {},
172
+ ...schemas
173
+ );
174
+ }
175
+ function parseNumber({
176
+ zodRef,
177
+ schemas,
178
+ openApiVersion
179
+ }) {
180
+ const baseSchema = {
181
+ type: typeFormat("number", openApiVersion)
182
+ };
183
+ const { checks = [] } = zodRef._def;
184
+ checks.forEach((item) => {
185
+ switch (item.kind) {
186
+ case "max":
187
+ if (item.inclusive || openApiVersion === "3.0") {
188
+ baseSchema.maximum = item.value;
189
+ }
190
+ if (!item.inclusive) {
191
+ if (openApiVersion === "3.0") {
192
+ baseSchema.exclusiveMaximum = true;
193
+ } else {
194
+ baseSchema.exclusiveMaximum = item.value;
195
+ }
196
+ }
197
+ break;
198
+ case "min":
199
+ if (item.inclusive || openApiVersion === "3.0") {
200
+ baseSchema.minimum = item.value;
201
+ }
202
+ if (!item.inclusive) {
203
+ if (openApiVersion === "3.0") {
204
+ baseSchema.exclusiveMinimum = true;
205
+ } else {
206
+ baseSchema.exclusiveMinimum = item.value;
207
+ }
208
+ }
209
+ break;
210
+ case "int":
211
+ baseSchema.type = typeFormat("integer", openApiVersion);
212
+ break;
213
+ case "multipleOf":
214
+ baseSchema.multipleOf = item.value;
215
+ break;
216
+ }
217
+ });
218
+ return (0, import_ts_deepmerge.merge)(
219
+ baseSchema,
220
+ zodRef.description ? { description: zodRef.description } : {},
221
+ ...schemas
222
+ );
223
+ }
224
+ function getExcludedDefinitionsFromSchema(schemas) {
225
+ const excludedDefinitions = [];
226
+ for (const schema of schemas) {
227
+ if (Array.isArray(schema.hideDefinitions)) {
228
+ excludedDefinitions.push(...schema.hideDefinitions);
229
+ }
230
+ }
231
+ return excludedDefinitions;
232
+ }
233
+ function parseObject({
234
+ zodRef,
235
+ schemas,
236
+ useOutput,
237
+ hideDefinitions,
238
+ openApiVersion
239
+ }) {
240
+ let additionalProperties;
241
+ if (!(zodRef._def.catchall instanceof import_v3.z.ZodNever || zodRef._def.catchall?._def.typeName === "ZodNever"))
242
+ additionalProperties = generateSchema(
243
+ zodRef._def.catchall,
244
+ useOutput,
245
+ openApiVersion
246
+ );
247
+ else if (zodRef._def.unknownKeys === "passthrough")
248
+ additionalProperties = true;
249
+ else if (zodRef._def.unknownKeys === "strict") additionalProperties = false;
250
+ additionalProperties = additionalProperties != null ? { additionalProperties } : {};
251
+ const requiredProperties = Object.keys(
252
+ zodRef.shape
253
+ ).filter((key) => {
254
+ const item = zodRef.shape[key];
255
+ return !(item.isOptional() || item instanceof import_v3.z.ZodDefault || item._def.typeName === "ZodDefault") && !(item instanceof import_v3.z.ZodNever || item._def.typeName === "ZodDefault");
256
+ });
257
+ const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
258
+ return (0, import_ts_deepmerge.merge)(
259
+ {
260
+ type: typeFormat("object", openApiVersion),
261
+ properties: iterateZodObject({
262
+ zodRef,
263
+ schemas,
264
+ useOutput,
265
+ hideDefinitions: getExcludedDefinitionsFromSchema(schemas),
266
+ openApiVersion
267
+ }),
268
+ ...required,
269
+ ...additionalProperties,
270
+ ...hideDefinitions
271
+ },
272
+ zodRef.description ? { description: zodRef.description, hideDefinitions } : {},
273
+ ...schemas
274
+ );
275
+ }
276
+ function parseRecord({
277
+ zodRef,
278
+ schemas,
279
+ useOutput,
280
+ openApiVersion
281
+ }) {
282
+ return (0, import_ts_deepmerge.merge)(
283
+ {
284
+ type: typeFormat("object", openApiVersion),
285
+ additionalProperties: zodRef._def.valueType instanceof import_v3.z.ZodUnknown ? {} : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
286
+ },
287
+ zodRef.description ? { description: zodRef.description } : {},
288
+ ...schemas
289
+ );
290
+ }
291
+ function parseBigInt({
292
+ zodRef,
293
+ schemas,
294
+ openApiVersion
295
+ }) {
296
+ return (0, import_ts_deepmerge.merge)(
297
+ {
298
+ type: typeFormat("integer", openApiVersion),
299
+ format: "int64"
300
+ },
301
+ zodRef.description ? { description: zodRef.description } : {},
302
+ ...schemas
303
+ );
304
+ }
305
+ function parseBoolean({
306
+ zodRef,
307
+ schemas,
308
+ openApiVersion
309
+ }) {
310
+ return (0, import_ts_deepmerge.merge)(
311
+ { type: typeFormat("boolean", openApiVersion) },
312
+ zodRef.description ? { description: zodRef.description } : {},
313
+ ...schemas
314
+ );
315
+ }
316
+ function parseDate({
317
+ zodRef,
318
+ schemas,
319
+ openApiVersion
320
+ }) {
321
+ return (0, import_ts_deepmerge.merge)(
322
+ {
323
+ type: typeFormat("string", openApiVersion),
324
+ format: "date-time"
325
+ },
326
+ zodRef.description ? { description: zodRef.description } : {},
327
+ ...schemas
328
+ );
329
+ }
330
+ function parseNull({
331
+ zodRef,
332
+ schemas,
333
+ openApiVersion
334
+ }) {
335
+ return (0, import_ts_deepmerge.merge)(
336
+ openApiVersion === "3.0" ? { type: "null" } : {
337
+ type: ["string", "null"],
338
+ enum: ["null"]
339
+ },
340
+ zodRef.description ? { description: zodRef.description } : {},
341
+ ...schemas
342
+ );
343
+ }
344
+ function parseOptional({
345
+ schemas,
346
+ zodRef,
347
+ useOutput,
348
+ openApiVersion
349
+ }) {
350
+ return (0, import_ts_deepmerge.merge)(
351
+ generateSchema(zodRef.unwrap(), useOutput, openApiVersion),
352
+ zodRef.description ? { description: zodRef.description } : {},
353
+ ...schemas
354
+ );
355
+ }
356
+ function parseNullable({
357
+ schemas,
358
+ zodRef,
359
+ useOutput,
360
+ openApiVersion
361
+ }) {
362
+ const schema = generateSchema(zodRef.unwrap(), useOutput, openApiVersion);
363
+ return (0, import_ts_deepmerge.merge)(
364
+ schema,
365
+ openApiVersion === "3.0" ? { nullable: true } : { type: typeFormat("null", openApiVersion) },
366
+ zodRef.description ? { description: zodRef.description } : {},
367
+ ...schemas
368
+ );
369
+ }
370
+ function parseDefault({
371
+ schemas,
372
+ zodRef,
373
+ useOutput,
374
+ openApiVersion
375
+ }) {
376
+ return (0, import_ts_deepmerge.merge)(
377
+ {
378
+ default: zodRef._def.defaultValue(),
379
+ ...generateSchema(zodRef._def.innerType, useOutput, openApiVersion)
380
+ },
381
+ zodRef.description ? { description: zodRef.description } : {},
382
+ ...schemas
383
+ );
384
+ }
385
+ function parseArray({
386
+ schemas,
387
+ zodRef,
388
+ useOutput,
389
+ openApiVersion
390
+ }) {
391
+ const constraints = {};
392
+ if (zodRef._def.exactLength != null) {
393
+ constraints.minItems = zodRef._def.exactLength.value;
394
+ constraints.maxItems = zodRef._def.exactLength.value;
395
+ }
396
+ if (zodRef._def.minLength != null)
397
+ constraints.minItems = zodRef._def.minLength.value;
398
+ if (zodRef._def.maxLength != null)
399
+ constraints.maxItems = zodRef._def.maxLength.value;
400
+ return (0, import_ts_deepmerge.merge)(
401
+ {
402
+ type: typeFormat("array", openApiVersion),
403
+ items: generateSchema(zodRef.element, useOutput, openApiVersion),
404
+ ...constraints
405
+ },
406
+ zodRef.description ? { description: zodRef.description } : {},
407
+ ...schemas
408
+ );
409
+ }
410
+ function parseLiteral({
411
+ schemas,
412
+ zodRef,
413
+ openApiVersion
414
+ }) {
415
+ const type2 = typeof zodRef._def.value;
416
+ return (0, import_ts_deepmerge.merge)(
417
+ {
418
+ type: typeFormat(type2, openApiVersion),
419
+ enum: [zodRef._def.value]
420
+ },
421
+ zodRef.description ? { description: zodRef.description } : {},
422
+ ...schemas
423
+ );
424
+ }
425
+ function parseEnum({
426
+ schemas,
427
+ zodRef,
428
+ openApiVersion
429
+ }) {
430
+ const type2 = typeof Object.values(zodRef._def.values)[0];
431
+ return (0, import_ts_deepmerge.merge)(
432
+ {
433
+ type: typeFormat(type2, openApiVersion),
434
+ enum: Object.values(zodRef._def.values)
435
+ },
436
+ zodRef.description ? { description: zodRef.description } : {},
437
+ ...schemas
438
+ );
439
+ }
440
+ function parseIntersection({
441
+ schemas,
442
+ zodRef,
443
+ useOutput,
444
+ openApiVersion
445
+ }) {
446
+ return (0, import_ts_deepmerge.merge)(
447
+ {
448
+ allOf: [
449
+ generateSchema(zodRef._def.left, useOutput, openApiVersion),
450
+ generateSchema(zodRef._def.right, useOutput, openApiVersion)
451
+ ]
452
+ },
453
+ zodRef.description ? { description: zodRef.description } : {},
454
+ ...schemas
455
+ );
456
+ }
457
+ function parseUnion({
458
+ schemas,
459
+ zodRef,
460
+ useOutput,
461
+ openApiVersion
462
+ }) {
463
+ const contents = zodRef._def.options;
464
+ if (contents.reduce(
465
+ (prev, content) => prev && content._def.typeName === "ZodLiteral",
466
+ true
467
+ )) {
468
+ const literals = contents;
469
+ const type2 = literals.reduce(
470
+ (prev, content) => !prev || prev === typeof content._def.value ? typeof content._def.value : null,
471
+ null
472
+ );
473
+ if (type2) {
474
+ return (0, import_ts_deepmerge.merge)(
475
+ {
476
+ type: typeFormat(type2, openApiVersion),
477
+ enum: literals.map((literal2) => literal2._def.value)
478
+ },
479
+ zodRef.description ? { description: zodRef.description } : {},
480
+ ...schemas
481
+ );
482
+ }
483
+ }
484
+ const oneOfContents = openApiVersion === "3.0" ? contents.filter((content) => content._def.typeName !== "ZodNull") : contents;
485
+ const contentsHasNull = contents.length != oneOfContents.length;
486
+ return (0, import_ts_deepmerge.merge)(
487
+ {
488
+ oneOf: oneOfContents.map(
489
+ (schema) => generateSchema(schema, useOutput, openApiVersion)
490
+ )
491
+ },
492
+ contentsHasNull ? { nullable: true } : {},
493
+ zodRef.description ? { description: zodRef.description } : {},
494
+ ...schemas
495
+ );
496
+ }
497
+ function parseDiscriminatedUnion({
498
+ schemas,
499
+ zodRef,
500
+ useOutput,
501
+ openApiVersion
502
+ }) {
503
+ return (0, import_ts_deepmerge.merge)(
504
+ {
505
+ discriminator: {
506
+ propertyName: zodRef._def.discriminator
507
+ },
508
+ oneOf: Array.from(
509
+ zodRef._def.options.values()
510
+ ).map((schema) => generateSchema(schema, useOutput, openApiVersion))
511
+ },
512
+ zodRef.description ? { description: zodRef.description } : {},
513
+ ...schemas
514
+ );
515
+ }
516
+ function parseNever({
517
+ zodRef,
518
+ schemas
519
+ }) {
520
+ return (0, import_ts_deepmerge.merge)(
521
+ { readOnly: true },
522
+ zodRef.description ? { description: zodRef.description } : {},
523
+ ...schemas
524
+ );
525
+ }
526
+ function parseBranded({
527
+ schemas,
528
+ zodRef,
529
+ useOutput,
530
+ openApiVersion
531
+ }) {
532
+ return (0, import_ts_deepmerge.merge)(
533
+ generateSchema(zodRef._def.type, useOutput, openApiVersion),
534
+ ...schemas
535
+ );
536
+ }
537
+ function catchAllParser({
538
+ zodRef,
539
+ schemas
540
+ }) {
541
+ return (0, import_ts_deepmerge.merge)(
542
+ zodRef.description ? { description: zodRef.description } : {},
543
+ ...schemas
544
+ );
545
+ }
546
+ function parsePipeline({
547
+ schemas,
548
+ zodRef,
549
+ useOutput,
550
+ openApiVersion
551
+ }) {
552
+ return (0, import_ts_deepmerge.merge)(
553
+ generateSchema(
554
+ useOutput ? zodRef._def.out : zodRef._def.in,
555
+ useOutput,
556
+ openApiVersion
557
+ ),
558
+ ...schemas
559
+ );
560
+ }
561
+ function parseReadonly({
562
+ zodRef,
563
+ useOutput,
564
+ schemas,
565
+ openApiVersion
566
+ }) {
567
+ return (0, import_ts_deepmerge.merge)(
568
+ generateSchema(zodRef._def.innerType, useOutput, openApiVersion),
569
+ zodRef.description ? { description: zodRef.description } : {},
570
+ ...schemas
571
+ );
572
+ }
573
+ var workerMap = {
574
+ ZodObject: parseObject,
575
+ ZodRecord: parseRecord,
576
+ ZodString: parseString,
577
+ ZodNumber: parseNumber,
578
+ ZodBigInt: parseBigInt,
579
+ ZodBoolean: parseBoolean,
580
+ ZodDate: parseDate,
581
+ ZodNull: parseNull,
582
+ ZodOptional: parseOptional,
583
+ ZodNullable: parseNullable,
584
+ ZodDefault: parseDefault,
585
+ ZodArray: parseArray,
586
+ ZodLiteral: parseLiteral,
587
+ ZodEnum: parseEnum,
588
+ ZodNativeEnum: parseEnum,
589
+ ZodTransformer: parseTransformation,
590
+ ZodEffects: parseTransformation,
591
+ ZodIntersection: parseIntersection,
592
+ ZodUnion: parseUnion,
593
+ ZodDiscriminatedUnion: parseDiscriminatedUnion,
594
+ ZodNever: parseNever,
595
+ ZodBranded: parseBranded,
596
+ // TODO Transform the rest to schemas
597
+ ZodUndefined: catchAllParser,
598
+ // TODO: `prefixItems` is allowed in OpenAPI 3.1 which can be used to create tuples
599
+ ZodTuple: catchAllParser,
600
+ ZodMap: catchAllParser,
601
+ ZodFunction: catchAllParser,
602
+ ZodLazy: catchAllParser,
603
+ ZodPromise: catchAllParser,
604
+ ZodAny: catchAllParser,
605
+ ZodUnknown: catchAllParser,
606
+ ZodVoid: catchAllParser,
607
+ ZodPipeline: parsePipeline,
608
+ ZodReadonly: parseReadonly
609
+ };
610
+ function generateSchema(zodRef, useOutput = false, openApiVersion = "3.1") {
611
+ const { metaOpenApi = {} } = zodRef;
612
+ const schemas = [
613
+ ...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
614
+ ];
615
+ try {
616
+ const typeName = zodRef._def.typeName;
617
+ if (typeName in workerMap) {
618
+ return workerMap[typeName]({
619
+ zodRef,
620
+ schemas,
621
+ useOutput,
622
+ openApiVersion
623
+ });
624
+ }
625
+ return catchAllParser({ zodRef, schemas, openApiVersion });
626
+ } catch (err) {
627
+ console.error(err);
628
+ return catchAllParser({ zodRef, schemas, openApiVersion });
629
+ }
630
+ }
631
+
632
+ // shims/zod-v3-openapi/zod-extensions.ts
633
+ function extendZodWithOpenApi(zod, forceOverride = false) {
634
+ if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
635
+ return;
636
+ }
637
+ zod.ZodSchema.prototype.openapi = function(metadata) {
638
+ return extendApi(this, metadata);
639
+ };
640
+ }
641
+
642
+ // src/zod/zodSchemaValidator.ts
643
+ extendZodWithOpenApi(import_v32.z);
64
644
  var ZodSchemaValidator = class {
65
645
  _Type = "Zod";
66
646
  _SchemaCatchall;
67
647
  _ValidSchemaObject;
68
- string = import_zod.z.string().openapi({
648
+ string = import_v32.z.string().openapi({
69
649
  title: "String",
70
650
  example: "a string"
71
651
  });
72
- uuid = import_zod.z.string().uuid().openapi({
652
+ uuid = import_v32.z.string().uuid().openapi({
73
653
  title: "UUID",
74
654
  format: "uuid",
75
655
  pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
76
656
  example: "a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
77
657
  });
78
- email = import_zod.z.string().email().openapi({
658
+ email = import_v32.z.string().email().openapi({
79
659
  title: "Email",
80
660
  format: "email",
81
661
  pattern: `(?:[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*|"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])`,
82
662
  example: "a@b.com"
83
663
  });
84
- uri = import_zod.z.string().url().openapi({
664
+ uri = import_v32.z.string().url().openapi({
85
665
  title: "URI",
86
666
  format: "uri",
87
667
  pattern: "^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$",
88
668
  example: "https://forklaunch.com"
89
669
  });
90
- number = import_zod.z.preprocess((value) => {
670
+ number = import_v32.z.preprocess((value) => {
91
671
  try {
92
672
  return Number(value);
93
673
  } catch {
94
674
  return value;
95
675
  }
96
- }, import_zod.z.number()).openapi({
676
+ }, import_v32.z.number()).openapi({
97
677
  title: "Number",
98
678
  example: 123
99
679
  });
100
- bigint = import_zod.z.preprocess((value) => {
680
+ bigint = import_v32.z.preprocess((value) => {
101
681
  try {
102
682
  if (value instanceof Date) {
103
683
  return BigInt(value.getTime());
@@ -114,23 +694,23 @@ var ZodSchemaValidator = class {
114
694
  } catch {
115
695
  return value;
116
696
  }
117
- }, import_zod.z.bigint()).openapi({
697
+ }, import_v32.z.bigint()).openapi({
118
698
  title: "BigInt",
119
699
  type: "integer",
120
700
  format: "int64",
121
701
  example: 123n
122
702
  });
123
- boolean = import_zod.z.preprocess((val) => {
703
+ boolean = import_v32.z.preprocess((val) => {
124
704
  if (typeof val === "string") {
125
705
  if (val.toLowerCase() === "true") return true;
126
706
  if (val.toLowerCase() === "false") return false;
127
707
  }
128
708
  return val;
129
- }, import_zod.z.boolean()).openapi({
709
+ }, import_v32.z.boolean()).openapi({
130
710
  title: "Boolean",
131
711
  example: true
132
712
  });
133
- date = import_zod.z.preprocess((value) => {
713
+ date = import_v32.z.preprocess((value) => {
134
714
  try {
135
715
  switch (typeof value) {
136
716
  case "string":
@@ -143,58 +723,58 @@ var ZodSchemaValidator = class {
143
723
  } catch {
144
724
  return value;
145
725
  }
146
- }, import_zod.z.date()).openapi({
726
+ }, import_v32.z.date()).openapi({
147
727
  title: "Date",
148
728
  type: "string",
149
729
  format: "date-time",
150
730
  example: "2025-05-16T21:13:04.123Z"
151
731
  });
152
- symbol = import_zod.z.symbol().openapi({
732
+ symbol = import_v32.z.symbol().openapi({
153
733
  title: "Symbol",
154
734
  example: Symbol("symbol")
155
735
  });
156
- nullish = import_zod.z.union([import_zod.z.void(), import_zod.z.null(), import_zod.z.undefined()]).openapi({
736
+ nullish = import_v32.z.union([import_v32.z.void(), import_v32.z.null(), import_v32.z.undefined()]).openapi({
157
737
  title: "Nullish",
158
738
  type: "null",
159
739
  example: null
160
740
  });
161
- void = import_zod.z.void().openapi({
741
+ void = import_v32.z.void().openapi({
162
742
  title: "Void",
163
743
  type: "null",
164
744
  example: void 0
165
745
  });
166
- null = import_zod.z.null().openapi({
746
+ null = import_v32.z.null().openapi({
167
747
  title: "Null",
168
748
  type: "null",
169
749
  example: null
170
750
  });
171
- undefined = import_zod.z.undefined().openapi({
751
+ undefined = import_v32.z.undefined().openapi({
172
752
  title: "Undefined",
173
753
  type: "null",
174
754
  example: void 0
175
755
  });
176
- any = import_zod.z.any().openapi({
756
+ any = import_v32.z.any().openapi({
177
757
  title: "Any",
178
758
  type: "object",
179
759
  example: "any"
180
760
  });
181
- unknown = import_zod.z.unknown().openapi({
761
+ unknown = import_v32.z.unknown().openapi({
182
762
  title: "Unknown",
183
763
  type: "object",
184
764
  example: "unknown"
185
765
  });
186
- never = import_zod.z.never().openapi({
766
+ never = import_v32.z.never().openapi({
187
767
  title: "Never",
188
768
  type: "null",
189
769
  example: "never"
190
770
  });
191
- binary = import_zod.z.string().transform((v) => new TextEncoder().encode(v)).openapi({
771
+ binary = import_v32.z.string().transform((v) => new TextEncoder().encode(v)).openapi({
192
772
  title: "Binary",
193
773
  type: "string",
194
774
  format: "binary",
195
775
  example: "a utf-8 encodable string"
196
776
  });
197
- file = import_zod.z.string().transform((val) => {
777
+ file = import_v32.z.string().transform((val) => {
198
778
  return new Blob([val]);
199
779
  }).openapi({
200
780
  title: "File",
@@ -219,20 +799,20 @@ var ZodSchemaValidator = class {
219
799
  */
220
800
  schemify(schema) {
221
801
  if (typeof schema === "string" || typeof schema === "number" || typeof schema === "boolean") {
222
- return import_zod.z.literal(schema);
802
+ return import_v32.z.literal(schema);
223
803
  }
224
- if (schema instanceof import_zod.ZodType) {
804
+ if (schema instanceof import_v32.ZodType) {
225
805
  return schema;
226
806
  }
227
807
  const newSchema = {};
228
808
  Object.getOwnPropertyNames(schema).forEach((key) => {
229
- if (schema[key] instanceof import_zod.ZodType) {
809
+ if (schema[key] instanceof import_v32.ZodType) {
230
810
  newSchema[key] = schema[key];
231
811
  } else {
232
812
  newSchema[key] = this.schemify(schema[key]);
233
813
  }
234
814
  });
235
- return import_zod.z.object(newSchema);
815
+ return import_v32.z.object(newSchema);
236
816
  }
237
817
  /**
238
818
  * Make a schema optional.
@@ -259,7 +839,7 @@ var ZodSchemaValidator = class {
259
839
  */
260
840
  union(schemas) {
261
841
  const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
262
- return import_zod.z.union(
842
+ return import_v32.z.union(
263
843
  resolvedSchemas
264
844
  );
265
845
  }
@@ -269,7 +849,7 @@ var ZodSchemaValidator = class {
269
849
  * @returns {ZodLiteral<ZodResolve<T>>} The literal schema.
270
850
  */
271
851
  literal(value) {
272
- return import_zod.z.literal(value);
852
+ return import_v32.z.literal(value);
273
853
  }
274
854
  /**
275
855
  * Create an enum schema.
@@ -290,7 +870,7 @@ var ZodSchemaValidator = class {
290
870
  function_(args, returnType) {
291
871
  const schemaArgs = args.map((schema) => this.schemify(schema));
292
872
  const schemaReturnType = this.schemify(returnType);
293
- return import_zod.z.function(import_zod.z.tuple(schemaArgs), schemaReturnType);
873
+ return import_v32.z.function(import_v32.z.tuple(schemaArgs), schemaReturnType);
294
874
  }
295
875
  /**
296
876
  * Create a record schema.
@@ -301,7 +881,7 @@ var ZodSchemaValidator = class {
301
881
  record(key, value) {
302
882
  const keySchema = this.schemify(key);
303
883
  const valueSchema = this.schemify(value);
304
- return import_zod.z.record(keySchema, valueSchema);
884
+ return import_v32.z.record(keySchema, valueSchema);
305
885
  }
306
886
  /**
307
887
  * Create a promise schema.
@@ -309,7 +889,7 @@ var ZodSchemaValidator = class {
309
889
  * @returns {ZodPromise<ZodResolve<T>>} The promise schema.
310
890
  */
311
891
  promise(schema) {
312
- return import_zod.z.promise(this.schemify(schema));
892
+ return import_v32.z.promise(this.schemify(schema));
313
893
  }
314
894
  /**
315
895
  * Checks if a value is a Zod schema.
@@ -317,7 +897,7 @@ var ZodSchemaValidator = class {
317
897
  * @returns {boolean} True if the value is a Zod schema.
318
898
  */
319
899
  isSchema(value) {
320
- return value instanceof import_zod.ZodType;
900
+ return value instanceof import_v32.ZodType;
321
901
  }
322
902
  /**
323
903
  * Checks if a value is an instance of a Zod schema.
@@ -380,7 +960,7 @@ var ZodSchemaValidator = class {
380
960
  * @returns {SchemaObject} The OpenAPI schema object.
381
961
  */
382
962
  openapi(schema) {
383
- return (0, import_zod_openapi.generateSchema)(this.schemify(schema));
963
+ return generateSchema(this.schemify(schema));
384
964
  }
385
965
  };
386
966