@kubb/plugin-zod 5.0.0-beta.42 → 5.0.0-beta.64

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
2
+ import { Exclude, Generator, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
3
3
  import { AdapterOas } from "@kubb/adapter-oas";
4
4
 
5
5
  //#region src/printers/printerZod.d.ts
@@ -171,7 +171,7 @@ type ResolverZod = Resolver & ast.OperationParamsResolver & {
171
171
  * Resolves the schema type name (inferred type from schema).
172
172
  *
173
173
  * @example Schema type names
174
- * `resolver.resolveSchemaTypeName('pet') // → 'Pet'`
174
+ * `resolver.resolveSchemaTypeName('pet') // → 'PetSchemaType'`
175
175
  */
176
176
  resolveSchemaTypeName(this: ResolverZod, name: string): string;
177
177
  /**
@@ -186,14 +186,14 @@ type ResolverZod = Resolver & ast.OperationParamsResolver & {
186
186
  * Resolves the inferred type name for the request (input) direction variant.
187
187
  *
188
188
  * @example Input schema type names
189
- * `resolver.resolveInputSchemaTypeName('order') // → 'OrderInputSchema'`
189
+ * `resolver.resolveInputSchemaTypeName('order') // → 'OrderInputSchemaType'`
190
190
  */
191
191
  resolveInputSchemaTypeName(this: ResolverZod, name: string): string;
192
192
  /**
193
193
  * Resolves the generated type name from the schema.
194
194
  *
195
195
  * @example Type names
196
- * `resolver.resolveTypeName('pet') // → 'Pet'`
196
+ * `resolver.resolveTypeName('petSchema') // → 'PetSchemaType'`
197
197
  */
198
198
  resolveTypeName(this: ResolverZod, name: string): string;
199
199
  /**
@@ -243,17 +243,13 @@ type ResolverZod = Resolver & ast.OperationParamsResolver & {
243
243
  */
244
244
  resolveHeaderParamsName(this: ResolverZod, node: ast.OperationNode, param: ast.ParameterNode): string;
245
245
  };
246
- type Options = {
247
- /**
248
- * Where the generated Zod schemas are written and how they are exported.
249
- *
250
- * @default { path: 'zod', barrel: { type: 'named' } }
251
- */
252
- output?: Output;
253
- /**
254
- * Split generated files into subfolders based on the operation's tag.
255
- */
256
- group?: Group;
246
+ /**
247
+ * Where the generated Zod schemas are written and how they are exported, plus the optional
248
+ * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
249
+ *
250
+ * @default { path: 'zod', barrel: { type: 'named' } }
251
+ */
252
+ type Options = OutputOptions & {
257
253
  /**
258
254
  * Skip operations matching at least one entry in the list.
259
255
  */
@@ -270,7 +266,7 @@ type Options = {
270
266
  * Module specifier used in the `import { z } from '...'` statement.
271
267
  * Use `'zod/mini'` for the tree-shakeable bundle.
272
268
  *
273
- * @default 'zod'
269
+ * @default mini ? 'zod/mini' : 'zod'
274
270
  */
275
271
  importPath?: 'zod' | 'zod/mini' | (string & {});
276
272
  /**
@@ -351,9 +347,9 @@ type Options = {
351
347
  nodes?: PrinterZodNodes | PrinterZodMiniNodes;
352
348
  };
353
349
  /**
354
- * AST visitor applied to each schema or operation node before printing.
350
+ * Macros applied to each schema or operation node before printing.
355
351
  */
356
- transformer?: ast.Visitor;
352
+ macros?: Array<ast.Macro>;
357
353
  };
358
354
  type ResolvedOptions = {
359
355
  output: Output;
@@ -427,14 +423,16 @@ declare const pluginZod: (options?: Options | undefined) => import("@kubb/core")
427
423
  /**
428
424
  * Default resolver used by `@kubb/plugin-zod`. Decides the names and file
429
425
  * paths for every generated Zod schema. Schemas use camelCase with a
430
- * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase.
426
+ * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase
427
+ * with a `SchemaType` suffix (`PetSchemaType`), so the value and the type
428
+ * never share an identifier even when the schema name is all-uppercase.
431
429
  *
432
430
  * @example Resolve schema and type names
433
431
  * ```ts
434
432
  * import { resolverZod } from '@kubb/plugin-zod'
435
433
  *
436
434
  * resolverZod.default('list pets', 'function') // 'listPetsSchema'
437
- * resolverZod.resolveSchemaTypeName('pet') // 'PetSchema'
435
+ * resolverZod.resolveSchemaTypeName('pet') // 'PetSchemaType'
438
436
  * ```
439
437
  */
440
438
  declare const resolverZod: ResolverZod;