@kubb/plugin-zod 5.0.0-beta.15 → 5.0.0-beta.25

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/index.js CHANGED
@@ -261,11 +261,11 @@ function buildSchemaNames(node, { params, resolver }) {
261
261
  }
262
262
  responses["default"] = resolver.resolveResponseName(node);
263
263
  return {
264
- request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0,
264
+ request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null,
265
265
  parameters: {
266
- path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : void 0,
267
- query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : void 0,
268
- header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : void 0
266
+ path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : null,
267
+ query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : null,
268
+ header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : null
269
269
  },
270
270
  responses,
271
271
  errors
@@ -339,27 +339,26 @@ function lengthChecksMini({ min, max, pattern }) {
339
339
  * to a schema value string using the chainable Zod v4 API.
340
340
  */
341
341
  function applyModifiers({ value, nullable, optional, nullish, defaultValue, description }) {
342
- let result = value;
343
- if (nullish || nullable && optional) result = `${result}.nullish()`;
344
- else if (optional) result = `${result}.optional()`;
345
- else if (nullable) result = `${result}.nullable()`;
346
- if (defaultValue !== void 0) result = `${result}.default(${formatDefault(defaultValue)})`;
347
- if (description) result = `${result}.describe(${stringify(description)})`;
348
- return result;
342
+ const withModifier = (() => {
343
+ if (nullish || nullable && optional) return `${value}.nullish()`;
344
+ if (optional) return `${value}.optional()`;
345
+ if (nullable) return `${value}.nullable()`;
346
+ return value;
347
+ })();
348
+ const withDefault = defaultValue !== void 0 ? `${withModifier}.default(${formatDefault(defaultValue)})` : withModifier;
349
+ return description ? `${withDefault}.describe(${stringify(description)})` : withDefault;
349
350
  }
350
351
  /**
351
352
  * Apply nullable / optional / nullish modifiers using the functional `zod/mini` API
352
353
  * (`z.nullable()`, `z.optional()`, `z.nullish()`).
353
354
  */
354
355
  function applyMiniModifiers({ value, nullable, optional, nullish, defaultValue }) {
355
- let result = value;
356
- if (nullish) result = `z.nullish(${result})`;
357
- else {
358
- if (nullable) result = `z.nullable(${result})`;
359
- if (optional) result = `z.optional(${result})`;
360
- }
361
- if (defaultValue !== void 0) result = `z._default(${result}, ${formatDefault(defaultValue)})`;
362
- return result;
356
+ const withModifier = (() => {
357
+ if (nullish) return `z.nullish(${value})`;
358
+ const withNullable = nullable ? `z.nullable(${value})` : value;
359
+ return optional ? `z.optional(${withNullable})` : withNullable;
360
+ })();
361
+ return defaultValue !== void 0 ? `z._default(${withModifier}, ${formatDefault(defaultValue)})` : withModifier;
363
362
  }
364
363
  //#endregion
365
364
  //#region src/printers/printerZod.ts
@@ -373,6 +372,11 @@ function strictOneOfMember$1(member, node) {
373
372
  return member;
374
373
  }
375
374
  __name(strictOneOfMember$1, "strictOneOfMember");
375
+ function getMemberConstraint(member) {
376
+ if (member.primitive === "string") return lengthConstraints(ast.narrowSchema(member, "string") ?? {}) || void 0;
377
+ if (member.primitive === "number" || member.primitive === "integer") return numberConstraints(ast.narrowSchema(member, "number") ?? ast.narrowSchema(member, "integer") ?? {}) || void 0;
378
+ if (member.primitive === "array") return lengthConstraints(ast.narrowSchema(member, "array") ?? {}) || void 0;
379
+ }
376
380
  /**
377
381
  * Zod v4 printer built with `definePrinter`.
378
382
  *
@@ -445,14 +449,14 @@ const printerZod = ast.definePrinter((options) => {
445
449
  return `z.enum([${nonNullValues.map(formatLiteral).join(", ")}])`;
446
450
  },
447
451
  ref(node) {
448
- if (!node.name) return void 0;
452
+ if (!node.name) return null;
449
453
  const refName = node.ref ? ast.extractRefName(node.ref) ?? node.name : node.name;
450
454
  const resolvedName = node.ref ? this.options.resolver?.default(refName, "function") ?? refName : node.name;
451
455
  if (node.ref && this.options.cyclicSchemas?.has(refName)) return `z.lazy(() => ${resolvedName})`;
452
456
  return resolvedName;
453
457
  },
454
458
  object(node) {
455
- let result = `z.object({\n ${node.properties.map((prop) => {
459
+ const objectBase = `z.object({\n ${node.properties.map((prop) => {
456
460
  const { name: propName, schema } = prop;
457
461
  const meta = ast.syncSchemaRef(schema);
458
462
  const isNullable = meta.nullable;
@@ -467,8 +471,7 @@ const printerZod = ast.definePrinter((options) => {
467
471
  output: baseOutput,
468
472
  schema
469
473
  }) || baseOutput : baseOutput;
470
- let descriptionToApply = meta.description;
471
- if (schema.type !== "ref" && meta.type === "ref") descriptionToApply = void 0;
474
+ const descriptionToApply = schema.type !== "ref" && meta.type === "ref" ? void 0 : meta.description;
472
475
  const value = applyModifiers({
473
476
  value: wrappedOutput,
474
477
  nullable: isNullable,
@@ -480,17 +483,19 @@ const printerZod = ast.definePrinter((options) => {
480
483
  if (hasSelfRef) return `get "${propName}"() { return ${value} }`;
481
484
  return `"${propName}": ${value}`;
482
485
  }).join(",\n ")}\n })`;
483
- if (node.additionalProperties && node.additionalProperties !== true) {
484
- const catchallType = this.transform(node.additionalProperties);
485
- if (catchallType) result += `.catchall(${catchallType})`;
486
- } else if (node.additionalProperties === true) result += `.catchall(${this.transform(ast.createSchema({ type: "unknown" }))})`;
487
- else if (node.additionalProperties === false) result += ".strict()";
488
- return result;
486
+ return (() => {
487
+ if (node.additionalProperties && node.additionalProperties !== true) {
488
+ const catchallType = this.transform(node.additionalProperties);
489
+ return catchallType ? `${objectBase}.catchall(${catchallType})` : objectBase;
490
+ }
491
+ if (node.additionalProperties === true) return `${objectBase}.catchall(${this.transform(ast.createSchema({ type: "unknown" }))})`;
492
+ if (node.additionalProperties === false) return `${objectBase}.strict()`;
493
+ return objectBase;
494
+ })();
489
495
  },
490
496
  array(node) {
491
- let result = `z.array(${(node.items ?? []).map((item) => this.transform(item)).filter(Boolean).join(", ") || this.transform(ast.createSchema({ type: "unknown" }))})${lengthConstraints(node)}`;
492
- if (node.unique) result += `.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })`;
493
- return result;
497
+ const base = `z.array(${(node.items ?? []).map((item) => this.transform(item)).filter(Boolean).join(", ") || this.transform(ast.createSchema({ type: "unknown" }))})${lengthConstraints(node)}`;
498
+ return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })` : base;
494
499
  },
495
500
  tuple(node) {
496
501
  return `z.tuple([${(node.items ?? []).map((item) => this.transform(item)).filter(Boolean).join(", ")}])`;
@@ -511,47 +516,29 @@ const printerZod = ast.definePrinter((options) => {
511
516
  if (members.length === 0) return "";
512
517
  const [first, ...rest] = members;
513
518
  if (!first) return "";
514
- let base = this.transform(first);
515
- if (!base) return "";
516
- for (const member of rest) {
517
- if (member.primitive === "string") {
518
- const c = lengthConstraints(ast.narrowSchema(member, "string") ?? {});
519
- if (c) {
520
- base += c;
521
- continue;
522
- }
523
- } else if (member.primitive === "number" || member.primitive === "integer") {
524
- const c = numberConstraints(ast.narrowSchema(member, "number") ?? ast.narrowSchema(member, "integer") ?? {});
525
- if (c) {
526
- base += c;
527
- continue;
528
- }
529
- } else if (member.primitive === "array") {
530
- const c = lengthConstraints(ast.narrowSchema(member, "array") ?? {});
531
- if (c) {
532
- base += c;
533
- continue;
534
- }
535
- }
519
+ const firstBase = this.transform(first);
520
+ if (!firstBase) return "";
521
+ return rest.reduce((acc, member) => {
522
+ const constraint = getMemberConstraint(member);
523
+ if (constraint) return acc + constraint;
536
524
  const transformed = this.transform(member);
537
- if (transformed) base = `${base}.and(${transformed})`;
538
- }
539
- return base;
525
+ return transformed ? `${acc}.and(${transformed})` : acc;
526
+ }, firstBase);
540
527
  },
541
528
  ...options.nodes
542
529
  },
543
530
  print(node) {
544
531
  const { keysToOmit } = this.options;
545
- let base = this.transform(node);
546
- if (!base) return null;
532
+ const transformed = this.transform(node);
533
+ if (!transformed) return null;
547
534
  const meta = ast.syncSchemaRef(node);
548
- if (keysToOmit?.length && meta.primitive === "object" && !(meta.type === "union" && meta.discriminatorPropertyName)) {
549
- const lazyMatch = base.match(/^z\.lazy\(\(\)\s*=>\s*(.+)\)$/);
550
- if (lazyMatch) base = `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} }))`;
551
- else base = `${base}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} })`;
552
- }
553
535
  return applyModifiers({
554
- value: base,
536
+ value: (() => {
537
+ if (!keysToOmit?.length || meta.primitive !== "object" || meta.type === "union" && meta.discriminatorPropertyName) return transformed;
538
+ const lazyMatch = transformed.match(/^z\.lazy\(\(\)\s*=>\s*(.+)\)$/);
539
+ if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} }))`;
540
+ return `${transformed}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} })`;
541
+ })(),
555
542
  nullable: meta.nullable,
556
543
  optional: meta.optional,
557
544
  nullish: meta.nullish,
@@ -567,6 +554,11 @@ function strictOneOfMember(member, node) {
567
554
  if (node.type === "object" && (node.additionalProperties === void 0 || node.additionalProperties === false)) return member.replace(/^z\.object\(/, "z.strictObject(");
568
555
  return member;
569
556
  }
557
+ function getMemberConstraintMini(member) {
558
+ if (member.primitive === "string") return lengthChecksMini(ast.narrowSchema(member, "string") ?? {}) || void 0;
559
+ if (member.primitive === "number" || member.primitive === "integer") return numberChecksMini(ast.narrowSchema(member, "number") ?? ast.narrowSchema(member, "integer") ?? {}) || void 0;
560
+ if (member.primitive === "array") return lengthChecksMini(ast.narrowSchema(member, "array") ?? {}) || void 0;
561
+ }
570
562
  /**
571
563
  * Zod v4 **Mini** printer built with `definePrinter`.
572
564
  *
@@ -635,7 +627,7 @@ const printerZodMini = ast.definePrinter((options) => {
635
627
  return `z.enum([${nonNullValues.map(formatLiteral).join(", ")}])`;
636
628
  },
637
629
  ref(node) {
638
- if (!node.name) return void 0;
630
+ if (!node.name) return null;
639
631
  const refName = node.ref ? ast.extractRefName(node.ref) ?? node.name : node.name;
640
632
  const resolvedName = node.ref ? this.options.resolver?.default(refName, "function") ?? refName : node.name;
641
633
  if (node.ref && this.options.cyclicSchemas?.has(refName)) return `z.lazy(() => ${resolvedName})`;
@@ -668,9 +660,8 @@ const printerZodMini = ast.definePrinter((options) => {
668
660
  }).join(",\n ")}\n })`;
669
661
  },
670
662
  array(node) {
671
- let result = `z.array(${(node.items ?? []).map((item) => this.transform(item)).filter(Boolean).join(", ") || this.transform(ast.createSchema({ type: "unknown" }))})${lengthChecksMini(node)}`;
672
- if (node.unique) result += `.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })`;
673
- return result;
663
+ const base = `z.array(${(node.items ?? []).map((item) => this.transform(item)).filter(Boolean).join(", ") || this.transform(ast.createSchema({ type: "unknown" }))})${lengthChecksMini(node)}`;
664
+ return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })` : base;
674
665
  },
675
666
  tuple(node) {
676
667
  return `z.tuple([${(node.items ?? []).map((item) => this.transform(item)).filter(Boolean).join(", ")}])`;
@@ -691,47 +682,29 @@ const printerZodMini = ast.definePrinter((options) => {
691
682
  if (members.length === 0) return "";
692
683
  const [first, ...rest] = members;
693
684
  if (!first) return "";
694
- let base = this.transform(first);
695
- if (!base) return "";
696
- for (const member of rest) {
697
- if (member.primitive === "string") {
698
- const c = lengthChecksMini(ast.narrowSchema(member, "string") ?? {});
699
- if (c) {
700
- base += c;
701
- continue;
702
- }
703
- } else if (member.primitive === "number" || member.primitive === "integer") {
704
- const c = numberChecksMini(ast.narrowSchema(member, "number") ?? ast.narrowSchema(member, "integer") ?? {});
705
- if (c) {
706
- base += c;
707
- continue;
708
- }
709
- } else if (member.primitive === "array") {
710
- const c = lengthChecksMini(ast.narrowSchema(member, "array") ?? {});
711
- if (c) {
712
- base += c;
713
- continue;
714
- }
715
- }
685
+ const firstBase = this.transform(first);
686
+ if (!firstBase) return "";
687
+ return rest.reduce((acc, member) => {
688
+ const constraint = getMemberConstraintMini(member);
689
+ if (constraint) return acc + constraint;
716
690
  const transformed = this.transform(member);
717
- if (transformed) base = `z.intersection(${base}, ${transformed})`;
718
- }
719
- return base;
691
+ return transformed ? `z.intersection(${acc}, ${transformed})` : acc;
692
+ }, firstBase);
720
693
  },
721
694
  ...options.nodes
722
695
  },
723
696
  print(node) {
724
697
  const { keysToOmit } = this.options;
725
- let base = this.transform(node);
726
- if (!base) return null;
698
+ const transformed = this.transform(node);
699
+ if (!transformed) return null;
727
700
  const meta = ast.syncSchemaRef(node);
728
- if (keysToOmit?.length && meta.primitive === "object" && !(meta.type === "union" && meta.discriminatorPropertyName)) {
729
- const lazyMatch = base.match(/^z\.lazy\(\(\)\s*=>\s*(.+)\)$/);
730
- if (lazyMatch) base = `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} }))`;
731
- else base = `${base}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} })`;
732
- }
733
701
  return applyMiniModifiers({
734
- value: base,
702
+ value: (() => {
703
+ if (!keysToOmit?.length || meta.primitive !== "object" || meta.type === "union" && meta.discriminatorPropertyName) return transformed;
704
+ const lazyMatch = transformed.match(/^z\.lazy\(\(\)\s*=>\s*(.+)\)$/);
705
+ if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} }))`;
706
+ return `${transformed}.omit({ ${keysToOmit.map((k) => `"${k}": true`).join(", ")} })`;
707
+ })(),
735
708
  nullable: meta.nullable,
736
709
  optional: meta.optional,
737
710
  nullish: meta.nullish,
@@ -744,11 +717,17 @@ const printerZodMini = ast.definePrinter((options) => {
744
717
  //#region src/generators/zodGenerator.tsx
745
718
  const zodPrinterCache = /* @__PURE__ */ new WeakMap();
746
719
  const zodMiniPrinterCache = /* @__PURE__ */ new WeakMap();
720
+ /**
721
+ * Built-in generator for `@kubb/plugin-zod`. Emits one Zod schema per
722
+ * schema in the spec plus per-operation request/response/parameter schemas.
723
+ * When `mini: true`, schemas use the Zod Mini functional API instead of
724
+ * chainable methods.
725
+ */
747
726
  const zodGenerator = defineGenerator({
748
727
  name: "zod",
749
728
  renderer: jsxRendererSync,
750
729
  schema(node, ctx) {
751
- const { adapter, config, resolver, root, inputNode } = ctx;
730
+ const { adapter, config, resolver, root } = ctx;
752
731
  const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = ctx.options;
753
732
  const dateType = adapter.options.dateType;
754
733
  if (!node.name) return;
@@ -762,7 +741,7 @@ const zodGenerator = defineGenerator({
762
741
  }, {
763
742
  root,
764
743
  output,
765
- group
744
+ group: group ?? void 0
766
745
  }).path
767
746
  }));
768
747
  const meta = {
@@ -773,11 +752,11 @@ const zodGenerator = defineGenerator({
773
752
  }, {
774
753
  root,
775
754
  output,
776
- group
755
+ group: group ?? void 0
777
756
  })
778
757
  };
779
- const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : void 0;
780
- const cyclicSchemas = ast.findCircularSchemas(inputNode.schemas);
758
+ const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : null;
759
+ const cyclicSchemas = new Set(ctx.meta.circularNames);
781
760
  const schemaPrinter = mini ? getCachedMiniPrinter() : getCachedStdPrinter();
782
761
  function getCachedStdPrinter() {
783
762
  const cached = zodPrinterCache.get(resolver);
@@ -819,11 +798,11 @@ const zodGenerator = defineGenerator({
819
798
  baseName: meta.file.baseName,
820
799
  path: meta.file.path,
821
800
  meta: meta.file.meta,
822
- banner: resolver.resolveBanner(inputNode, {
801
+ banner: resolver.resolveBanner(ctx.meta, {
823
802
  output,
824
803
  config
825
804
  }),
826
- footer: resolver.resolveFooter(inputNode, {
805
+ footer: resolver.resolveFooter(ctx.meta, {
827
806
  output,
828
807
  config
829
808
  }),
@@ -848,7 +827,7 @@ const zodGenerator = defineGenerator({
848
827
  });
849
828
  },
850
829
  operation(node, ctx) {
851
- const { adapter, config, resolver, root, inputNode } = ctx;
830
+ const { adapter, config, resolver, root } = ctx;
852
831
  const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = ctx.options;
853
832
  const dateType = adapter.options.dateType;
854
833
  const mode = ctx.getMode(output);
@@ -862,12 +841,12 @@ const zodGenerator = defineGenerator({
862
841
  }, {
863
842
  root,
864
843
  output,
865
- group
844
+ group: group ?? void 0
866
845
  }) };
867
- const cyclicSchemas = ast.findCircularSchemas(inputNode.schemas);
846
+ const cyclicSchemas = new Set(ctx.meta.circularNames);
868
847
  function renderSchemaEntry({ schema, name, keysToOmit }) {
869
848
  if (!schema) return null;
870
- const inferTypeName = inferred ? resolver.resolveTypeName(name) : void 0;
849
+ const inferTypeName = inferred ? resolver.resolveTypeName(name) : null;
871
850
  const imports = adapter.getImports(schema, (schemaName) => ({
872
851
  name: resolver.resolveSchemaName(schemaName),
873
852
  path: resolver.resolveFile({
@@ -876,7 +855,7 @@ const zodGenerator = defineGenerator({
876
855
  }, {
877
856
  root,
878
857
  output,
879
- group
858
+ group: group ?? void 0
880
859
  }).path
881
860
  }));
882
861
  const cachedStd = zodPrinterCache.get(resolver);
@@ -967,11 +946,11 @@ const zodGenerator = defineGenerator({
967
946
  baseName: meta.file.baseName,
968
947
  path: meta.file.path,
969
948
  meta: meta.file.meta,
970
- banner: resolver.resolveBanner(inputNode, {
949
+ banner: resolver.resolveBanner(ctx.meta, {
971
950
  output,
972
951
  config
973
952
  }),
974
- footer: resolver.resolveFooter(inputNode, {
953
+ footer: resolver.resolveFooter(ctx.meta, {
975
954
  output,
976
955
  config
977
956
  }),
@@ -989,7 +968,7 @@ const zodGenerator = defineGenerator({
989
968
  });
990
969
  },
991
970
  operations(nodes, ctx) {
992
- const { config, resolver, root, inputNode } = ctx;
971
+ const { config, resolver, root } = ctx;
993
972
  const { output, importPath, group, operations, paramsCasing } = ctx.options;
994
973
  if (!operations) return;
995
974
  const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath);
@@ -999,7 +978,7 @@ const zodGenerator = defineGenerator({
999
978
  }, {
1000
979
  root,
1001
980
  output,
1002
- group
981
+ group: group ?? void 0
1003
982
  }) };
1004
983
  const transformedOperations = nodes.map((node) => {
1005
984
  return {
@@ -1024,7 +1003,7 @@ const zodGenerator = defineGenerator({
1024
1003
  }, {
1025
1004
  root,
1026
1005
  output,
1027
- group
1006
+ group: group ?? void 0
1028
1007
  });
1029
1008
  return names.map((name) => /* @__PURE__ */ jsx(File.Import, {
1030
1009
  name: [name],
@@ -1036,11 +1015,11 @@ const zodGenerator = defineGenerator({
1036
1015
  baseName: meta.file.baseName,
1037
1016
  path: meta.file.path,
1038
1017
  meta: meta.file.meta,
1039
- banner: resolver.resolveBanner(inputNode, {
1018
+ banner: resolver.resolveBanner(ctx.meta, {
1040
1019
  output,
1041
1020
  config
1042
1021
  }),
1043
- footer: resolver.resolveFooter(inputNode, {
1022
+ footer: resolver.resolveFooter(ctx.meta, {
1044
1023
  output,
1045
1024
  config
1046
1025
  }),
@@ -1063,12 +1042,17 @@ const zodGenerator = defineGenerator({
1063
1042
  //#endregion
1064
1043
  //#region src/resolvers/resolverZod.ts
1065
1044
  /**
1066
- * Naming convention resolver for Zod plugin.
1045
+ * Default resolver used by `@kubb/plugin-zod`. Decides the names and file
1046
+ * paths for every generated Zod schema. Schemas use camelCase with a
1047
+ * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase.
1067
1048
  *
1068
- * Provides default naming helpers using camelCase with a `Schema` suffix for schemas.
1049
+ * @example Resolve schema and type names
1050
+ * ```ts
1051
+ * import { resolverZod } from '@kubb/plugin-zod'
1069
1052
  *
1070
- * @example
1071
- * `resolverZod.default('list pets', 'function') // 'listPetsSchema'`
1053
+ * resolverZod.default('list pets', 'function') // 'listPetsSchema'
1054
+ * resolverZod.resolveSchemaTypeName('pet') // 'PetSchema'
1055
+ * ```
1072
1056
  */
1073
1057
  const resolverZod = defineResolver(() => {
1074
1058
  return {
@@ -1121,19 +1105,32 @@ const resolverZod = defineResolver(() => {
1121
1105
  //#endregion
1122
1106
  //#region src/plugin.ts
1123
1107
  /**
1124
- * Canonical plugin name for `@kubb/plugin-zod`, used in driver lookups and warnings.
1108
+ * Canonical plugin name for `@kubb/plugin-zod`. Used for driver lookups and
1109
+ * cross-plugin dependency references.
1125
1110
  */
1126
1111
  const pluginZodName = "plugin-zod";
1127
1112
  /**
1128
- * Generates Zod validation schemas from an OpenAPI specification.
1129
- * Walks schemas and operations, delegates to generators, and writes barrel files
1130
- * based on the configured `barrelType`.
1113
+ * Generates Zod v4 schemas from an OpenAPI spec. Use them to validate API
1114
+ * responses at runtime, build form schemas, or feed back into router libraries
1115
+ * that consume Zod (tRPC, Hono, Elysia). Pair with `@kubb/plugin-client` and
1116
+ * set the client's `parser: 'zod'` to validate every response automatically.
1131
1117
  *
1132
- * @example Zod schema generator
1118
+ * @example
1133
1119
  * ```ts
1134
- * import pluginZod from '@kubb/plugin-zod'
1120
+ * import { defineConfig } from 'kubb'
1121
+ * import { pluginTs } from '@kubb/plugin-ts'
1122
+ * import { pluginZod } from '@kubb/plugin-zod'
1123
+ *
1135
1124
  * export default defineConfig({
1136
- * plugins: [pluginZod({ output: { path: 'zod' } })]
1125
+ * input: { path: './petStore.yaml' },
1126
+ * output: { path: './src/gen' },
1127
+ * plugins: [
1128
+ * pluginTs(),
1129
+ * pluginZod({
1130
+ * output: { path: './zod' },
1131
+ * typed: true,
1132
+ * }),
1133
+ * ],
1137
1134
  * })
1138
1135
  * ```
1139
1136
  */
@@ -1148,7 +1145,7 @@ const pluginZod = definePlugin((options) => {
1148
1145
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
1149
1146
  return `${camelCase(ctx.group)}Controller`;
1150
1147
  }
1151
- } : void 0;
1148
+ } : null;
1152
1149
  return {
1153
1150
  name: pluginZodName,
1154
1151
  options,