@kubb/plugin-zod 4.20.2 → 4.20.5

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.
Files changed (73) hide show
  1. package/dist/components.d.cts +2 -1
  2. package/dist/components.d.ts +2 -1
  3. package/dist/{generators-DWTQMdiR.js → generators-BawvbIJ1.js} +13 -7
  4. package/dist/generators-BawvbIJ1.js.map +1 -0
  5. package/dist/{generators-YkwNz13t.cjs → generators-DGBZd16i.cjs} +13 -7
  6. package/dist/generators-DGBZd16i.cjs.map +1 -0
  7. package/dist/generators.cjs +1 -1
  8. package/dist/generators.d.cts +1 -1
  9. package/dist/generators.d.ts +1 -1
  10. package/dist/generators.js +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +3 -2
  13. package/dist/index.d.ts +3 -2
  14. package/dist/index.js +1 -1
  15. package/dist/types-23ND42NW.d.cts +696 -0
  16. package/dist/types-CyZ4p-xC.d.ts +695 -0
  17. package/package.json +10 -6
  18. package/src/generators/__snapshots__/anyof.ts +1 -1
  19. package/src/generators/__snapshots__/coercion.ts +1 -1
  20. package/src/generators/__snapshots__/coercionDates.ts +1 -1
  21. package/src/generators/__snapshots__/coercionNumbers.ts +1 -1
  22. package/src/generators/__snapshots__/coercionStrings.ts +1 -1
  23. package/src/generators/__snapshots__/createItemUnionWithReadOnly.ts +1 -1
  24. package/src/generators/__snapshots__/createPet.ts +1 -1
  25. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +1 -1
  26. package/src/generators/__snapshots__/deletePet.ts +1 -1
  27. package/src/generators/__snapshots__/discriminator.ts +1 -1
  28. package/src/generators/__snapshots__/enumBooleanLiteral.ts +1 -1
  29. package/src/generators/__snapshots__/enumNamesType.ts +1 -1
  30. package/src/generators/__snapshots__/enumNullable.ts +1 -1
  31. package/src/generators/__snapshots__/enumSingleLiteral.ts +1 -1
  32. package/src/generators/__snapshots__/enumVarNamesType.ts +1 -1
  33. package/src/generators/__snapshots__/example.ts +1 -1
  34. package/src/generators/__snapshots__/exclusiveNumbers.ts +1 -1
  35. package/src/generators/__snapshots__/getPets.ts +1 -1
  36. package/src/generators/__snapshots__/getPetsWithQueryFilter_wrapOutput_all_.ts +1 -1
  37. package/src/generators/__snapshots__/imageNullable.ts +1 -1
  38. package/src/generators/__snapshots__/mixedValueTypeConst.ts +1 -1
  39. package/src/generators/__snapshots__/nullable.ts +1 -1
  40. package/src/generators/__snapshots__/nullableString.ts +1 -1
  41. package/src/generators/__snapshots__/nullableStringUuid.ts +1 -1
  42. package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +1 -1
  43. package/src/generators/__snapshots__/numberValueConst.ts +1 -1
  44. package/src/generators/__snapshots__/oneof.ts +1 -1
  45. package/src/generators/__snapshots__/operations.ts +1 -1
  46. package/src/generators/__snapshots__/optionalPetInfer.ts +1 -1
  47. package/src/generators/__snapshots__/optionalPetTyped.ts +1 -1
  48. package/src/generators/__snapshots__/order.ts +1 -1
  49. package/src/generators/__snapshots__/orderDateTyeString.ts +1 -1
  50. package/src/generators/__snapshots__/orderDateTypeFalse.ts +1 -1
  51. package/src/generators/__snapshots__/orderDateTypeString.ts +1 -1
  52. package/src/generators/__snapshots__/pet.ts +1 -1
  53. package/src/generators/__snapshots__/petArray.ts +1 -1
  54. package/src/generators/__snapshots__/petCoercion.ts +1 -1
  55. package/src/generators/__snapshots__/petTupleObject.ts +1 -1
  56. package/src/generators/__snapshots__/petV4.ts +1 -1
  57. package/src/generators/__snapshots__/petWithMapper.ts +1 -1
  58. package/src/generators/__snapshots__/pets.ts +1 -1
  59. package/src/generators/__snapshots__/queryAllDefaulted.ts +1 -1
  60. package/src/generators/__snapshots__/recursive.ts +1 -1
  61. package/src/generators/__snapshots__/showPetById.ts +1 -1
  62. package/src/generators/__snapshots__/stringValueConst.ts +1 -1
  63. package/src/generators/__snapshots__/toy.ts +1 -1
  64. package/src/generators/__snapshots__/unionWithReadOnly.ts +1 -1
  65. package/src/generators/__snapshots__/updateItemUnionWithReadOnly.ts +1 -1
  66. package/src/generators/__snapshots__/uuidSchema.ts +1 -1
  67. package/src/generators/operationsGenerator.tsx +3 -1
  68. package/src/generators/zodGenerator.tsx +6 -2
  69. package/templates/ToZod.ts +1 -1
  70. package/dist/generators-DWTQMdiR.js.map +0 -1
  71. package/dist/generators-YkwNz13t.cjs.map +0 -1
  72. package/dist/types-BBLRijaO.d.ts +0 -1354
  73. package/dist/types-HQfz08mH.d.cts +0 -1355
@@ -0,0 +1,696 @@
1
+ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
2
+ import BaseOas from "oas";
3
+ import { Operation } from "oas/operation";
4
+ import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
5
+ import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
6
+ import { KubbFile } from "@kubb/fabric-core/types";
7
+ import { Fabric } from "@kubb/react-fabric";
8
+ import { FabricReactNode } from "@kubb/react-fabric/types";
9
+
10
+ //#region rolldown:runtime
11
+ //#endregion
12
+ //#region ../oas/src/types.d.ts
13
+ type contentType = 'application/json' | (string & {});
14
+ type SchemaObject$1 = SchemaObject & {
15
+ 'x-nullable'?: boolean;
16
+ $ref?: string;
17
+ };
18
+ type HttpMethod = HttpMethods;
19
+ type Document = OASDocument;
20
+ type Operation$1 = Operation;
21
+ type DiscriminatorObject$1 = DiscriminatorObject;
22
+ //#endregion
23
+ //#region ../oas/src/Oas.d.ts
24
+ type OasOptions = {
25
+ contentType?: contentType;
26
+ discriminator?: 'strict' | 'inherit';
27
+ /**
28
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
29
+ * @default false
30
+ */
31
+ collisionDetection?: boolean;
32
+ };
33
+ declare class Oas extends BaseOas {
34
+ #private;
35
+ document: Document;
36
+ constructor(document: Document);
37
+ setOptions(options: OasOptions): void;
38
+ get options(): OasOptions;
39
+ get<T = unknown>($ref: string): T | null;
40
+ getKey($ref: string): string | undefined;
41
+ set($ref: string, value: unknown): false | undefined;
42
+ getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
43
+ dereferenceWithRef<T = unknown>(schema?: T): T;
44
+ getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
45
+ getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
46
+ getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
47
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
48
+ flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
49
+ /**
50
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
51
+ * Returns schemas in dependency order along with name mapping for collision resolution.
52
+ */
53
+ getSchemas(options?: {
54
+ contentType?: contentType;
55
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
56
+ collisionDetection?: boolean;
57
+ }): {
58
+ schemas: Record<string, SchemaObject$1>;
59
+ nameMapping: Map<string, string>;
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
64
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
65
+ #private;
66
+ constructor(maxListener?: number);
67
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
68
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
69
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
70
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
71
+ removeAll(): void;
72
+ }
73
+ //#endregion
74
+ //#region ../core/src/types.d.ts
75
+ declare global {
76
+ namespace Kubb {
77
+ interface PluginContext {}
78
+ }
79
+ }
80
+ /**
81
+ * Config used in `kubb.config.ts`
82
+ *
83
+ * @example
84
+ * import { defineConfig } from '@kubb/core'
85
+ * export default defineConfig({
86
+ * ...
87
+ * })
88
+ */
89
+ //#endregion
90
+ //#region ../plugin-oas/src/SchemaMapper.d.ts
91
+ type SchemaKeywordMapper = {
92
+ object: {
93
+ keyword: 'object';
94
+ args: {
95
+ properties: {
96
+ [x: string]: Schema[];
97
+ };
98
+ additionalProperties: Schema[];
99
+ patternProperties?: Record<string, Schema[]>;
100
+ strict?: boolean;
101
+ };
102
+ };
103
+ url: {
104
+ keyword: 'url';
105
+ };
106
+ readOnly: {
107
+ keyword: 'readOnly';
108
+ };
109
+ writeOnly: {
110
+ keyword: 'writeOnly';
111
+ };
112
+ uuid: {
113
+ keyword: 'uuid';
114
+ };
115
+ email: {
116
+ keyword: 'email';
117
+ };
118
+ firstName: {
119
+ keyword: 'firstName';
120
+ };
121
+ lastName: {
122
+ keyword: 'lastName';
123
+ };
124
+ phone: {
125
+ keyword: 'phone';
126
+ };
127
+ password: {
128
+ keyword: 'password';
129
+ };
130
+ date: {
131
+ keyword: 'date';
132
+ args: {
133
+ type?: 'date' | 'string';
134
+ };
135
+ };
136
+ time: {
137
+ keyword: 'time';
138
+ args: {
139
+ type?: 'date' | 'string';
140
+ };
141
+ };
142
+ datetime: {
143
+ keyword: 'datetime';
144
+ args: {
145
+ offset?: boolean;
146
+ local?: boolean;
147
+ };
148
+ };
149
+ tuple: {
150
+ keyword: 'tuple';
151
+ args: {
152
+ items: Schema[];
153
+ min?: number;
154
+ max?: number;
155
+ rest?: Schema;
156
+ };
157
+ };
158
+ array: {
159
+ keyword: 'array';
160
+ args: {
161
+ items: Schema[];
162
+ min?: number;
163
+ max?: number;
164
+ unique?: boolean;
165
+ };
166
+ };
167
+ enum: {
168
+ keyword: 'enum';
169
+ args: {
170
+ name: string;
171
+ typeName: string;
172
+ asConst: boolean;
173
+ items: Array<{
174
+ name: string | number;
175
+ format: 'string' | 'number' | 'boolean';
176
+ value?: string | number | boolean;
177
+ }>;
178
+ };
179
+ };
180
+ and: {
181
+ keyword: 'and';
182
+ args: Schema[];
183
+ };
184
+ const: {
185
+ keyword: 'const';
186
+ args: {
187
+ name: string | number;
188
+ format: 'string' | 'number' | 'boolean';
189
+ value?: string | number | boolean;
190
+ };
191
+ };
192
+ union: {
193
+ keyword: 'union';
194
+ args: Schema[];
195
+ };
196
+ ref: {
197
+ keyword: 'ref';
198
+ args: {
199
+ name: string;
200
+ $ref: string;
201
+ /**
202
+ * Full qualified path.
203
+ */
204
+ path: KubbFile.Path;
205
+ /**
206
+ * When true `File.Import` is used.
207
+ * When false a reference is used inside the current file.
208
+ */
209
+ isImportable: boolean;
210
+ };
211
+ };
212
+ matches: {
213
+ keyword: 'matches';
214
+ args?: string;
215
+ };
216
+ boolean: {
217
+ keyword: 'boolean';
218
+ };
219
+ default: {
220
+ keyword: 'default';
221
+ args: string | number | boolean;
222
+ };
223
+ string: {
224
+ keyword: 'string';
225
+ };
226
+ integer: {
227
+ keyword: 'integer';
228
+ };
229
+ number: {
230
+ keyword: 'number';
231
+ };
232
+ max: {
233
+ keyword: 'max';
234
+ args: number;
235
+ };
236
+ min: {
237
+ keyword: 'min';
238
+ args: number;
239
+ };
240
+ exclusiveMaximum: {
241
+ keyword: 'exclusiveMaximum';
242
+ args: number;
243
+ };
244
+ exclusiveMinimum: {
245
+ keyword: 'exclusiveMinimum';
246
+ args: number;
247
+ };
248
+ describe: {
249
+ keyword: 'describe';
250
+ args: string;
251
+ };
252
+ example: {
253
+ keyword: 'example';
254
+ args: string;
255
+ };
256
+ deprecated: {
257
+ keyword: 'deprecated';
258
+ };
259
+ optional: {
260
+ keyword: 'optional';
261
+ };
262
+ undefined: {
263
+ keyword: 'undefined';
264
+ };
265
+ nullish: {
266
+ keyword: 'nullish';
267
+ };
268
+ nullable: {
269
+ keyword: 'nullable';
270
+ };
271
+ null: {
272
+ keyword: 'null';
273
+ };
274
+ any: {
275
+ keyword: 'any';
276
+ };
277
+ unknown: {
278
+ keyword: 'unknown';
279
+ };
280
+ void: {
281
+ keyword: 'void';
282
+ };
283
+ blob: {
284
+ keyword: 'blob';
285
+ };
286
+ schema: {
287
+ keyword: 'schema';
288
+ args: {
289
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
290
+ format?: string;
291
+ };
292
+ };
293
+ name: {
294
+ keyword: 'name';
295
+ args: string;
296
+ };
297
+ catchall: {
298
+ keyword: 'catchall';
299
+ };
300
+ interface: {
301
+ keyword: 'interface';
302
+ };
303
+ };
304
+ type Schema = {
305
+ keyword: string;
306
+ } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
307
+ //#endregion
308
+ //#region ../plugin-oas/src/types.d.ts
309
+ type GetOasOptions = {
310
+ validate?: boolean;
311
+ };
312
+ type Context$2 = {
313
+ getOas(options?: GetOasOptions): Promise<Oas>;
314
+ getBaseURL(): Promise<string | undefined>;
315
+ };
316
+ declare global {
317
+ namespace Kubb {
318
+ interface PluginContext extends Context$2 {}
319
+ }
320
+ }
321
+ type ResolvePathOptions = {
322
+ pluginKey?: Plugin['key'];
323
+ group?: {
324
+ tag?: string;
325
+ path?: string;
326
+ };
327
+ type?: ResolveNameParams['type'];
328
+ };
329
+ /**
330
+ * `propertyName` is the ref name + resolved with the nameResolver
331
+ * @example import { Pet } from './Pet'
332
+ *
333
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
334
+ *
335
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
336
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
337
+ */
338
+ type Ref = {
339
+ propertyName: string;
340
+ originalName: string;
341
+ path: KubbFile.Path;
342
+ pluginKey?: Plugin['key'];
343
+ };
344
+ type Refs = Record<string, Ref>;
345
+ type OperationSchema = {
346
+ /**
347
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
348
+ */
349
+ name: string;
350
+ schema: SchemaObject$1;
351
+ operation?: Operation$1;
352
+ /**
353
+ * OperationName in PascalCase, only being used in OperationGenerator
354
+ */
355
+ operationName: string;
356
+ description?: string;
357
+ statusCode?: number;
358
+ keys?: string[];
359
+ keysToOmit?: string[];
360
+ withData?: boolean;
361
+ };
362
+ type OperationSchemas = {
363
+ pathParams?: OperationSchema & {
364
+ keysToOmit?: never;
365
+ };
366
+ queryParams?: OperationSchema & {
367
+ keysToOmit?: never;
368
+ };
369
+ headerParams?: OperationSchema & {
370
+ keysToOmit?: never;
371
+ };
372
+ request?: OperationSchema;
373
+ response: OperationSchema;
374
+ responses: Array<OperationSchema>;
375
+ statusCodes?: Array<OperationSchema>;
376
+ errors?: Array<OperationSchema>;
377
+ };
378
+ type ByTag = {
379
+ type: 'tag';
380
+ pattern: string | RegExp;
381
+ };
382
+ type ByOperationId = {
383
+ type: 'operationId';
384
+ pattern: string | RegExp;
385
+ };
386
+ type ByPath = {
387
+ type: 'path';
388
+ pattern: string | RegExp;
389
+ };
390
+ type ByMethod = {
391
+ type: 'method';
392
+ pattern: HttpMethod | RegExp;
393
+ };
394
+ type BySchemaName = {
395
+ type: 'schemaName';
396
+ pattern: string | RegExp;
397
+ };
398
+ type ByContentType = {
399
+ type: 'contentType';
400
+ pattern: string | RegExp;
401
+ };
402
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
403
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
404
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
405
+ options: Partial<TOptions>;
406
+ };
407
+ //#endregion
408
+ //#region ../plugin-oas/src/SchemaGenerator.d.ts
409
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
410
+ fabric: Fabric;
411
+ oas: Oas;
412
+ pluginManager: PluginManager;
413
+ events?: AsyncEventEmitter<KubbEvents>;
414
+ /**
415
+ * Current plugin
416
+ */
417
+ plugin: Plugin<TPluginOptions>;
418
+ mode: KubbFile.Mode;
419
+ include?: Array<'schemas' | 'responses' | 'requestBodies'>;
420
+ override: Array<Override<TOptions>> | undefined;
421
+ contentType?: contentType;
422
+ output?: string;
423
+ };
424
+ type SchemaGeneratorOptions = {
425
+ dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
426
+ unknownType: 'any' | 'unknown' | 'void';
427
+ emptySchemaType: 'any' | 'unknown' | 'void';
428
+ enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
429
+ enumSuffix?: string;
430
+ /**
431
+ * @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
432
+ * When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
433
+ * @internal
434
+ */
435
+ usedEnumNames?: Record<string, number>;
436
+ mapper?: Record<string, string>;
437
+ typed?: boolean;
438
+ transformers: {
439
+ /**
440
+ * Customize the names based on the type that is provided by the plugin.
441
+ */
442
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
443
+ /**
444
+ * Receive schema and name(propertyName) and return FakerMeta array
445
+ * TODO TODO add docs
446
+ * @beta
447
+ */
448
+ schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
449
+ };
450
+ };
451
+ type SchemaProps$1 = {
452
+ schema: SchemaObject$1 | null;
453
+ name: string | null;
454
+ parentName: string | null;
455
+ rootName?: string | null;
456
+ };
457
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
458
+ #private;
459
+ refs: Refs;
460
+ /**
461
+ * Creates a type node from a given schema.
462
+ * Delegates to getBaseTypeFromSchema internally and
463
+ * optionally adds a union with null.
464
+ */
465
+ parse(props: SchemaProps$1): Schema[];
466
+ static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
467
+ static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
468
+ static combineObjects(tree: Schema[] | undefined): Schema[];
469
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
470
+ }
471
+ //#endregion
472
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
473
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
474
+ name: string;
475
+ type: 'core';
476
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
477
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
478
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
479
+ };
480
+ //#endregion
481
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
482
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
483
+ name: string;
484
+ type: 'react';
485
+ Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
486
+ Operation: (props: OperationProps<TOptions>) => FabricReactNode;
487
+ Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
488
+ };
489
+ //#endregion
490
+ //#region ../plugin-oas/src/generators/types.d.ts
491
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
492
+ config: Config;
493
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
494
+ plugin: Plugin<TOptions>;
495
+ operations: Array<Operation$1>;
496
+ };
497
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
498
+ config: Config;
499
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
500
+ plugin: Plugin<TOptions>;
501
+ operation: Operation$1;
502
+ };
503
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
504
+ config: Config;
505
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
506
+ plugin: Plugin<TOptions>;
507
+ schema: {
508
+ name: string;
509
+ tree: Array<Schema>;
510
+ value: SchemaObject$1;
511
+ };
512
+ };
513
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
514
+ //#endregion
515
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
516
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
517
+ fabric: Fabric;
518
+ oas: Oas;
519
+ exclude: Array<Exclude$1> | undefined;
520
+ include: Array<Include> | undefined;
521
+ override: Array<Override<TOptions>> | undefined;
522
+ contentType: contentType | undefined;
523
+ pluginManager: PluginManager;
524
+ events?: AsyncEventEmitter<KubbEvents>;
525
+ /**
526
+ * Current plugin
527
+ */
528
+ plugin: Plugin<TPluginOptions>;
529
+ mode: KubbFile.Mode;
530
+ UNSTABLE_NAMING?: true;
531
+ };
532
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
533
+ #private;
534
+ getOptions(operation: Operation$1, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
535
+ getSchemas(operation: Operation$1, {
536
+ resolveName
537
+ }?: {
538
+ resolveName?: (name: string) => string;
539
+ }): OperationSchemas;
540
+ getOperations(): Promise<Array<{
541
+ path: string;
542
+ method: HttpMethod;
543
+ operation: Operation$1;
544
+ }>>;
545
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
546
+ }
547
+ //#endregion
548
+ //#region src/types.d.ts
549
+ type Options = {
550
+ /**
551
+ * @default 'zod'
552
+ */
553
+ output?: Output<Oas>;
554
+ /**
555
+ * Define which contentType should be used.
556
+ * By default, the first JSON valid mediaType is used
557
+ */
558
+ contentType?: contentType;
559
+ /**
560
+ * Group the Zod schemas based on the provided name.
561
+ */
562
+ group?: Group;
563
+ /**
564
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
565
+ */
566
+ exclude?: Array<Exclude$1>;
567
+ /**
568
+ * Array containing include parameters to include tags/operations/methods/paths.
569
+ */
570
+ include?: Array<Include>;
571
+ /**
572
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
573
+ */
574
+ override?: Array<Override<ResolvedOptions>>;
575
+ /**
576
+ * Path to Zod
577
+ * It used as `import { z } from '${importPath}'`.
578
+ * Accepts relative and absolute paths.
579
+ * Path is used as-is; relative paths are based on the generated file location.
580
+ * @default 'zod'
581
+ */
582
+ importPath?: string;
583
+ /**
584
+ * Choose to use date or datetime as JavaScript Date instead of string.
585
+ * - false falls back to a simple z.string() format.
586
+ * - 'string' uses z.string().datetime() for datetime validation.
587
+ * - 'stringOffset' uses z.string().datetime({ offset: true }) for datetime with timezone offset validation.
588
+ * - 'stringLocal' uses z.string().datetime({ local: true }) for local datetime validation.
589
+ * - 'date' uses z.date() for JavaScript Date objects.
590
+ * @default 'string'
591
+ * @note 'stringOffset' will become the default in Kubb v3.
592
+ */
593
+ dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
594
+ /**
595
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
596
+ * - 'any' allows any value.
597
+ * - 'unknown' requires type narrowing before use.
598
+ * - 'void' represents no value.
599
+ * @default 'any'
600
+ */
601
+ unknownType?: 'any' | 'unknown' | 'void';
602
+ /**
603
+ * Which type to use for empty schema values.
604
+ * - 'any' allows any value.
605
+ * - 'unknown' requires type narrowing before use.
606
+ * - 'void' represents no value.
607
+ * @default `unknownType`
608
+ */
609
+ emptySchemaType?: 'any' | 'unknown' | 'void';
610
+ /**
611
+ * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
612
+ */
613
+ typed?: boolean;
614
+ /**
615
+ * Return Zod generated schema as type with z.infer<TYPE>
616
+ */
617
+ inferred?: boolean;
618
+ /**
619
+ * Use of z.coerce.string() instead of z.string()
620
+ * can also be an object to enable coercion for dates, strings, and numbers
621
+ */
622
+ coercion?: boolean | {
623
+ dates?: boolean;
624
+ strings?: boolean;
625
+ numbers?: boolean;
626
+ };
627
+ operations?: boolean;
628
+ mapper?: Record<string, string>;
629
+ transformers?: {
630
+ /**
631
+ * Customize the names based on the type that is provided by the plugin.
632
+ */
633
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
634
+ /**
635
+ * Receive schema and baseName(propertyName) and return FakerMeta array
636
+ * TODO TODO add docs
637
+ * @beta
638
+ */
639
+ schema?: (props: {
640
+ schema: SchemaObject$1 | null;
641
+ name: string | null;
642
+ parentName: string | null;
643
+ }, defaultSchemas: Schema[]) => Schema[] | undefined;
644
+ };
645
+ /**
646
+ * Which version of Zod should be used.
647
+ * - '3' uses Zod v3.x syntax and features.
648
+ * - '4' uses Zod v4.x syntax and features.
649
+ * @default '3'
650
+ */
651
+ version?: '3' | '4';
652
+ /**
653
+ * Use Zod Mini's functional API for better tree-shaking support.
654
+ * When enabled, generates functional syntax (e.g., `z.optional(z.string())`) instead of chainable methods (e.g., `z.string().optional()`).
655
+ * Requires Zod v4 or later. When `mini: true`, `version` is set to '4' and `importPath` will default to 'zod/mini'.
656
+ * @default false
657
+ */
658
+ mini?: boolean;
659
+ /**
660
+ * Callback function to wrap the output of the generated zod schema
661
+ *
662
+ * This is useful for edge case scenarios where you might leverage something like `z.object({ ... }).openapi({ example: { some: "complex-example" }})`
663
+ * or `extendApi(z.object({ ... }), { example: { some: "complex-example", ...otherOpenApiProperties }})`
664
+ * while going from openapi -> zod -> openapi
665
+ */
666
+ wrapOutput?: (arg: {
667
+ output: string;
668
+ schema: SchemaObject$1;
669
+ }) => string | undefined;
670
+ /**
671
+ * Define some generators next to the zod generators
672
+ */
673
+ generators?: Array<Generator<PluginZod>>;
674
+ };
675
+ type ResolvedOptions = {
676
+ output: Output<Oas>;
677
+ group: Options['group'];
678
+ override: NonNullable<Options['override']>;
679
+ transformers: NonNullable<Options['transformers']>;
680
+ dateType: NonNullable<Options['dateType']>;
681
+ unknownType: NonNullable<Options['unknownType']>;
682
+ emptySchemaType: NonNullable<Options['emptySchemaType']>;
683
+ typed: NonNullable<Options['typed']>;
684
+ inferred: NonNullable<Options['inferred']>;
685
+ mapper: NonNullable<Options['mapper']>;
686
+ importPath: NonNullable<Options['importPath']>;
687
+ coercion: NonNullable<Options['coercion']>;
688
+ operations: NonNullable<Options['operations']>;
689
+ wrapOutput: Options['wrapOutput'];
690
+ version: NonNullable<Options['version']>;
691
+ mini: NonNullable<Options['mini']>;
692
+ };
693
+ type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
694
+ //#endregion
695
+ export { Operation$1 as a, Schema as i, PluginZod as n, SchemaObject$1 as o, ReactGenerator as r, __name as s, Options as t };
696
+ //# sourceMappingURL=types-23ND42NW.d.cts.map