@kubb/plugin-zod 4.1.3 → 4.2.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/README.md +18 -16
- package/dist/{components-Btq9ngUK.js → components-8y_GG0Uf.js} +57 -20
- package/dist/components-8y_GG0Uf.js.map +1 -0
- package/dist/{components-DiXPMONd.cjs → components-DwRiz-bh.cjs} +56 -19
- package/dist/components-DwRiz-bh.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-DIVRsyWg.cjs → generators-BO4N79H7.cjs} +23 -9
- package/dist/generators-BO4N79H7.cjs.map +1 -0
- package/dist/{generators-YcatTu7g.js → generators-bYDLojHd.js} +24 -11
- package/dist/generators-bYDLojHd.js.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 +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{types-BY-RtmUj.d.ts → types-CQb3A4Sz.d.ts} +69 -69
- package/dist/{types-C4zDVwZ4.d.cts → types-w5zjJR8e.d.cts} +69 -69
- package/package.json +9 -10
- package/src/components/Operations.tsx +23 -1
- package/src/generators/__snapshots__/operations.ts +19 -0
- package/src/generators/operationsGenerator.tsx +9 -8
- package/src/generators/zodGenerator.tsx +9 -7
- package/dist/components-Btq9ngUK.js.map +0 -1
- package/dist/components-DiXPMONd.cjs.map +0 -1
- package/dist/generators-DIVRsyWg.cjs.map +0 -1
- package/dist/generators-YcatTu7g.js.map +0 -1
|
@@ -46,17 +46,17 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
46
46
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
47
47
|
* @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
|
|
48
48
|
*/
|
|
49
|
-
declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
49
|
+
declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
|
|
50
50
|
#private;
|
|
51
|
-
constructor(options?: TOptions, context?: TContext);
|
|
52
|
-
get options(): TOptions;
|
|
51
|
+
constructor(options?: TOptions$1, context?: TContext);
|
|
52
|
+
get options(): TOptions$1;
|
|
53
53
|
get context(): TContext;
|
|
54
|
-
set options(options: TOptions);
|
|
54
|
+
set options(options: TOptions$1);
|
|
55
55
|
abstract build(...params: unknown[]): unknown;
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region ../core/src/fs/types.d.ts
|
|
59
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
59
|
+
type BasePath<T$1 extends string = string> = `${T$1}/`;
|
|
60
60
|
type Import = {
|
|
61
61
|
/**
|
|
62
62
|
* Import name to be used
|
|
@@ -130,7 +130,7 @@ type BaseName = `${string}.${string}`;
|
|
|
130
130
|
* Path will be full qualified path to a specified file
|
|
131
131
|
*/
|
|
132
132
|
type Path = string;
|
|
133
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
133
|
+
type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
|
|
134
134
|
type OptionalPath = Path | undefined | null;
|
|
135
135
|
type File<TMeta extends object = object> = {
|
|
136
136
|
/**
|
|
@@ -219,9 +219,9 @@ type Logger = {
|
|
|
219
219
|
};
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region ../core/src/utils/types.d.ts
|
|
222
|
-
type PossiblePromise<T> = Promise<T> | T;
|
|
223
|
-
type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
|
|
224
|
-
type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
|
|
222
|
+
type PossiblePromise<T$1> = Promise<T$1> | T$1;
|
|
223
|
+
type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
|
|
224
|
+
type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region ../core/src/types.d.ts
|
|
227
227
|
type InputPath = {
|
|
@@ -334,11 +334,11 @@ TName extends string = string,
|
|
|
334
334
|
/**
|
|
335
335
|
* Options of the plugin.
|
|
336
336
|
*/
|
|
337
|
-
TOptions extends object = object,
|
|
337
|
+
TOptions$1 extends object = object,
|
|
338
338
|
/**
|
|
339
339
|
* Options of the plugin that can be used later on, see `options` inside your plugin config.
|
|
340
340
|
*/
|
|
341
|
-
TResolvedOptions extends object = TOptions,
|
|
341
|
+
TResolvedOptions extends object = TOptions$1,
|
|
342
342
|
/**
|
|
343
343
|
* Context that you want to expose to other plugins.
|
|
344
344
|
*/
|
|
@@ -352,23 +352,23 @@ TResolvePathOptions extends object = object> = {
|
|
|
352
352
|
* Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
353
353
|
*/
|
|
354
354
|
key: PluginKey<TName | string>;
|
|
355
|
-
options: TOptions;
|
|
355
|
+
options: TOptions$1;
|
|
356
356
|
resolvedOptions: TResolvedOptions;
|
|
357
357
|
context: TContext;
|
|
358
358
|
resolvePathOptions: TResolvePathOptions;
|
|
359
359
|
};
|
|
360
360
|
type PluginKey<TName> = [name: TName, identifier?: string | number];
|
|
361
|
-
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
361
|
+
type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
362
362
|
/**
|
|
363
363
|
* Unique name used for the plugin
|
|
364
364
|
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
365
365
|
* @example @kubb/typescript
|
|
366
366
|
*/
|
|
367
|
-
name: TOptions['name'];
|
|
367
|
+
name: TOptions$1['name'];
|
|
368
368
|
/**
|
|
369
369
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
370
370
|
*/
|
|
371
|
-
options: TOptions['resolvedOptions'];
|
|
371
|
+
options: TOptions$1['resolvedOptions'];
|
|
372
372
|
/**
|
|
373
373
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
374
374
|
* Can be used to validate dependent plugins.
|
|
@@ -378,23 +378,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
378
378
|
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
|
|
379
379
|
*/
|
|
380
380
|
post?: Array<string>;
|
|
381
|
-
} & (TOptions['context'] extends never ? {
|
|
381
|
+
} & (TOptions$1['context'] extends never ? {
|
|
382
382
|
context?: never;
|
|
383
383
|
} : {
|
|
384
|
-
context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
|
|
384
|
+
context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
|
|
385
385
|
});
|
|
386
|
-
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
387
|
-
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
386
|
+
type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
387
|
+
type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
388
388
|
/**
|
|
389
389
|
* Unique name used for the plugin
|
|
390
390
|
* @example @kubb/typescript
|
|
391
391
|
*/
|
|
392
|
-
name: TOptions['name'];
|
|
392
|
+
name: TOptions$1['name'];
|
|
393
393
|
/**
|
|
394
394
|
* Internal key used when a developer uses more than one of the same plugin
|
|
395
395
|
* @private
|
|
396
396
|
*/
|
|
397
|
-
key: TOptions['key'];
|
|
397
|
+
key: TOptions$1['key'];
|
|
398
398
|
/**
|
|
399
399
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
400
400
|
* Can be used to validate dependent plugins.
|
|
@@ -407,49 +407,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
407
407
|
/**
|
|
408
408
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
409
409
|
*/
|
|
410
|
-
options: TOptions['resolvedOptions'];
|
|
411
|
-
} & (TOptions['context'] extends never ? {
|
|
410
|
+
options: TOptions$1['resolvedOptions'];
|
|
411
|
+
} & (TOptions$1['context'] extends never ? {
|
|
412
412
|
context?: never;
|
|
413
413
|
} : {
|
|
414
|
-
context: TOptions['context'];
|
|
414
|
+
context: TOptions$1['context'];
|
|
415
415
|
});
|
|
416
|
-
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
417
|
-
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
416
|
+
type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
417
|
+
type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
418
418
|
/**
|
|
419
419
|
* Start of the lifecycle of a plugin.
|
|
420
420
|
* @type hookParallel
|
|
421
421
|
*/
|
|
422
|
-
buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
|
|
422
|
+
buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
|
|
423
423
|
/**
|
|
424
424
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
425
425
|
* Options can als be included.
|
|
426
426
|
* @type hookFirst
|
|
427
427
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
428
428
|
*/
|
|
429
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
429
|
+
resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
|
|
430
430
|
/**
|
|
431
431
|
* Resolve to a name based on a string.
|
|
432
432
|
* Useful when converting to PascalCase or camelCase.
|
|
433
433
|
* @type hookFirst
|
|
434
434
|
* @example ('pet') => 'Pet'
|
|
435
435
|
*/
|
|
436
|
-
resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
436
|
+
resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
437
437
|
/**
|
|
438
438
|
* End of the plugin lifecycle.
|
|
439
439
|
* @type hookParallel
|
|
440
440
|
*/
|
|
441
|
-
buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
441
|
+
buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
|
|
442
442
|
};
|
|
443
443
|
type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
444
|
-
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
445
|
-
type ResolvePathParams<TOptions = object> = {
|
|
444
|
+
type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
|
|
445
|
+
type ResolvePathParams<TOptions$1 = object> = {
|
|
446
446
|
pluginKey?: Plugin['key'];
|
|
447
447
|
baseName: BaseName;
|
|
448
448
|
mode?: Mode;
|
|
449
449
|
/**
|
|
450
450
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
451
451
|
*/
|
|
452
|
-
options?: TOptions;
|
|
452
|
+
options?: TOptions$1;
|
|
453
453
|
};
|
|
454
454
|
type ResolveNameParams = {
|
|
455
455
|
name: string;
|
|
@@ -462,12 +462,12 @@ type ResolveNameParams = {
|
|
|
462
462
|
*/
|
|
463
463
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
464
464
|
};
|
|
465
|
-
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
465
|
+
type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
466
466
|
config: Config;
|
|
467
467
|
fileManager: FileManager;
|
|
468
468
|
pluginManager: PluginManager;
|
|
469
469
|
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
470
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
470
|
+
resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
|
|
471
471
|
resolveName: (params: ResolveNameParams) => string;
|
|
472
472
|
logger: Logger;
|
|
473
473
|
/**
|
|
@@ -477,12 +477,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
477
477
|
/**
|
|
478
478
|
* Current plugin
|
|
479
479
|
*/
|
|
480
|
-
plugin: Plugin<TOptions>;
|
|
480
|
+
plugin: Plugin<TOptions$1>;
|
|
481
481
|
};
|
|
482
482
|
/**
|
|
483
483
|
* Specify the export location for the files and define the behavior of the output
|
|
484
484
|
*/
|
|
485
|
-
type Output<TOptions> = {
|
|
485
|
+
type Output<TOptions$1> = {
|
|
486
486
|
/**
|
|
487
487
|
* Path to the output folder or file that will contain the generated code
|
|
488
488
|
*/
|
|
@@ -495,11 +495,11 @@ type Output<TOptions> = {
|
|
|
495
495
|
/**
|
|
496
496
|
* Add a banner text in the beginning of every file
|
|
497
497
|
*/
|
|
498
|
-
banner?: string | ((options: TOptions) => string);
|
|
498
|
+
banner?: string | ((options: TOptions$1) => string);
|
|
499
499
|
/**
|
|
500
500
|
* Add a footer text in the beginning of every file
|
|
501
501
|
*/
|
|
502
|
-
footer?: string | ((options: TOptions) => string);
|
|
502
|
+
footer?: string | ((options: TOptions$1) => string);
|
|
503
503
|
};
|
|
504
504
|
type GroupContext = {
|
|
505
505
|
group: string;
|
|
@@ -519,7 +519,7 @@ type Group = {
|
|
|
519
519
|
type FileMetaBase = {
|
|
520
520
|
pluginKey?: Plugin['key'];
|
|
521
521
|
};
|
|
522
|
-
type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
522
|
+
type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
523
523
|
type AddIndexesProps = {
|
|
524
524
|
type: BarrelType | false | undefined;
|
|
525
525
|
/**
|
|
@@ -572,16 +572,16 @@ declare class FileManager {
|
|
|
572
572
|
//#region ../core/src/PluginManager.d.ts
|
|
573
573
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
574
574
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
575
|
-
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
575
|
+
type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
576
576
|
message: string;
|
|
577
577
|
strategy: Strategy;
|
|
578
|
-
hookName: H;
|
|
578
|
+
hookName: H$1;
|
|
579
579
|
plugin: Plugin;
|
|
580
580
|
parameters?: unknown[] | undefined;
|
|
581
581
|
output?: unknown;
|
|
582
582
|
};
|
|
583
|
-
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
584
|
-
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
583
|
+
type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
|
|
584
|
+
type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
|
|
585
585
|
result: Result;
|
|
586
586
|
plugin: Plugin;
|
|
587
587
|
};
|
|
@@ -597,12 +597,12 @@ type Events = {
|
|
|
597
597
|
executed: [executer: Executer];
|
|
598
598
|
error: [error: Error];
|
|
599
599
|
};
|
|
600
|
-
type GetFileProps<TOptions = object> = {
|
|
600
|
+
type GetFileProps<TOptions$1 = object> = {
|
|
601
601
|
name: string;
|
|
602
602
|
mode?: Mode;
|
|
603
603
|
extname: Extname;
|
|
604
604
|
pluginKey: Plugin['key'];
|
|
605
|
-
options?: TOptions;
|
|
605
|
+
options?: TOptions$1;
|
|
606
606
|
};
|
|
607
607
|
declare class PluginManager {
|
|
608
608
|
#private;
|
|
@@ -716,11 +716,11 @@ declare class PluginManager {
|
|
|
716
716
|
}
|
|
717
717
|
//#endregion
|
|
718
718
|
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
719
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
719
|
+
type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
720
720
|
oas: Oas;
|
|
721
721
|
exclude: Array<Exclude$1> | undefined;
|
|
722
722
|
include: Array<Include> | undefined;
|
|
723
|
-
override: Array<Override<TOptions>> | undefined;
|
|
723
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
724
724
|
contentType: contentType | undefined;
|
|
725
725
|
pluginManager: PluginManager;
|
|
726
726
|
/**
|
|
@@ -954,7 +954,7 @@ type Schema = {
|
|
|
954
954
|
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
955
955
|
//#endregion
|
|
956
956
|
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
957
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
957
|
+
type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
958
958
|
oas: Oas;
|
|
959
959
|
pluginManager: PluginManager;
|
|
960
960
|
/**
|
|
@@ -963,7 +963,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
963
963
|
plugin: Plugin<TPluginOptions>;
|
|
964
964
|
mode: Mode;
|
|
965
965
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
966
|
-
override: Array<Override<TOptions>> | undefined;
|
|
966
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
967
967
|
contentType?: contentType;
|
|
968
968
|
output?: string;
|
|
969
969
|
};
|
|
@@ -994,7 +994,7 @@ type SchemaProps$1 = {
|
|
|
994
994
|
name?: string;
|
|
995
995
|
parentName?: string;
|
|
996
996
|
};
|
|
997
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
997
|
+
declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions$1, Context<TOptions$1, TPluginOptions>> {
|
|
998
998
|
#private;
|
|
999
999
|
refs: Refs;
|
|
1000
1000
|
/**
|
|
@@ -1013,32 +1013,32 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1013
1013
|
}
|
|
1014
1014
|
//#endregion
|
|
1015
1015
|
//#region ../plugin-oas/src/generator.d.ts
|
|
1016
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
1017
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
1018
|
-
options: TOptions['resolvedOptions'];
|
|
1016
|
+
type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
1017
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
1018
|
+
options: TOptions$1['resolvedOptions'];
|
|
1019
1019
|
operations: Array<Operation$1>;
|
|
1020
1020
|
};
|
|
1021
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
1022
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
1023
|
-
options: TOptions['resolvedOptions'];
|
|
1021
|
+
type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
1022
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
1023
|
+
options: TOptions$1['resolvedOptions'];
|
|
1024
1024
|
operation: Operation$1;
|
|
1025
1025
|
};
|
|
1026
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
1027
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
1028
|
-
options: TOptions['resolvedOptions'];
|
|
1026
|
+
type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
1027
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
|
|
1028
|
+
options: TOptions$1['resolvedOptions'];
|
|
1029
1029
|
schema: {
|
|
1030
1030
|
name: string;
|
|
1031
1031
|
tree: Array<Schema>;
|
|
1032
1032
|
value: SchemaObject$1;
|
|
1033
1033
|
};
|
|
1034
1034
|
};
|
|
1035
|
-
type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
1035
|
+
type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
|
|
1036
1036
|
name: string;
|
|
1037
|
-
operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
1038
|
-
operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<File[]>;
|
|
1039
|
-
schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
1037
|
+
operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
|
|
1038
|
+
operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
|
|
1039
|
+
schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
|
|
1040
1040
|
};
|
|
1041
|
-
type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
|
|
1041
|
+
type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
|
|
1042
1042
|
//#endregion
|
|
1043
1043
|
//#region ../plugin-oas/src/types.d.ts
|
|
1044
1044
|
type ResolvePathOptions = {
|
|
@@ -1124,8 +1124,8 @@ type ByContentType = {
|
|
|
1124
1124
|
};
|
|
1125
1125
|
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
1126
1126
|
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
1127
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
1128
|
-
options: Partial<TOptions>;
|
|
1127
|
+
type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
1128
|
+
options: Partial<TOptions$1>;
|
|
1129
1129
|
};
|
|
1130
1130
|
//#endregion
|
|
1131
1131
|
//#region src/types.d.ts
|
|
@@ -1254,5 +1254,5 @@ type ResolvedOptions = {
|
|
|
1254
1254
|
};
|
|
1255
1255
|
type PluginZod = PluginFactoryOptions<'plugin-zod', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1256
1256
|
//#endregion
|
|
1257
|
-
export {
|
|
1258
|
-
//# sourceMappingURL=types-
|
|
1257
|
+
export { UserPluginWithLifeCycle as a, Schema as i, PluginZod as n, Operation$1 as o, Generator as r, SchemaObject$1 as s, Options$1 as t };
|
|
1258
|
+
//# sourceMappingURL=types-w5zjJR8e.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-zod",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Zod schema generator plugin for Kubb, creating type-safe validation schemas from OpenAPI specifications for runtime data validation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -69,19 +69,18 @@
|
|
|
69
69
|
"!/**/__tests__/**"
|
|
70
70
|
],
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@kubb/core": "4.
|
|
73
|
-
"@kubb/oas": "4.
|
|
74
|
-
"@kubb/
|
|
75
|
-
"@kubb/plugin-
|
|
76
|
-
"@kubb/
|
|
77
|
-
"@kubb/react": "4.1.3"
|
|
72
|
+
"@kubb/core": "4.2.0",
|
|
73
|
+
"@kubb/oas": "4.2.0",
|
|
74
|
+
"@kubb/plugin-oas": "4.2.0",
|
|
75
|
+
"@kubb/plugin-ts": "4.2.0",
|
|
76
|
+
"@kubb/react": "4.2.0"
|
|
78
77
|
},
|
|
79
78
|
"devDependencies": {
|
|
80
|
-
"@asteasolutions/zod-to-openapi": "^
|
|
79
|
+
"@asteasolutions/zod-to-openapi": "^8.1.0",
|
|
81
80
|
"@hono/zod-openapi": "0.19.2",
|
|
82
|
-
"tsdown": "^0.15.
|
|
81
|
+
"tsdown": "^0.15.9",
|
|
83
82
|
"zod": "^3.25.76",
|
|
84
|
-
"@kubb/plugin-oas": "4.
|
|
83
|
+
"@kubb/plugin-oas": "4.2.0"
|
|
85
84
|
},
|
|
86
85
|
"peerDependencies": {
|
|
87
86
|
"@kubb/react": "^4.0.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SchemaNames } from '@kubb/plugin-oas/hooks'
|
|
2
|
-
import { Const, File } from '@kubb/react'
|
|
2
|
+
import { Const, File, Type } from '@kubb/react'
|
|
3
3
|
|
|
4
4
|
import transformers from '@kubb/core/transformers'
|
|
5
5
|
import type { HttpMethod, Operation } from '@kubb/oas'
|
|
@@ -33,6 +33,28 @@ export function Operations({ name, operations }: Props) {
|
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<>
|
|
36
|
+
<File.Source name="OperationSchema" isExportable isIndexable>
|
|
37
|
+
<Type name="OperationSchema" export>{`{
|
|
38
|
+
readonly request: z.ZodTypeAny | undefined;
|
|
39
|
+
readonly parameters: {
|
|
40
|
+
readonly path: z.ZodTypeAny | undefined;
|
|
41
|
+
readonly query: z.ZodTypeAny | undefined;
|
|
42
|
+
readonly header: z.ZodTypeAny | undefined;
|
|
43
|
+
};
|
|
44
|
+
readonly responses: {
|
|
45
|
+
readonly [status: number]: z.ZodTypeAny;
|
|
46
|
+
readonly default: z.ZodTypeAny;
|
|
47
|
+
};
|
|
48
|
+
readonly errors: {
|
|
49
|
+
readonly [status: number]: z.ZodTypeAny;
|
|
50
|
+
};
|
|
51
|
+
}`}</Type>
|
|
52
|
+
</File.Source>
|
|
53
|
+
<File.Source name="OperationsMap" isExportable isIndexable>
|
|
54
|
+
<Type name="OperationsMap" export>
|
|
55
|
+
{'Record<string, OperationSchema>'}
|
|
56
|
+
</Type>
|
|
57
|
+
</File.Source>
|
|
36
58
|
<File.Source name={name} isExportable isIndexable>
|
|
37
59
|
<Const export name={name} asConst>
|
|
38
60
|
{`{${transformers.stringifyObject(operationsJSON)}}`}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Generated by Kubb (https://kubb.dev/).
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
+
import type { z } from 'zod'
|
|
5
6
|
import {
|
|
6
7
|
listPets200,
|
|
7
8
|
listPetsQueryResponse,
|
|
@@ -18,6 +19,24 @@ import {
|
|
|
18
19
|
deletePetHeaderParams,
|
|
19
20
|
} from './showPetById'
|
|
20
21
|
|
|
22
|
+
export type OperationSchema = {
|
|
23
|
+
readonly request: z.ZodTypeAny | undefined
|
|
24
|
+
readonly parameters: {
|
|
25
|
+
readonly path: z.ZodTypeAny | undefined
|
|
26
|
+
readonly query: z.ZodTypeAny | undefined
|
|
27
|
+
readonly header: z.ZodTypeAny | undefined
|
|
28
|
+
}
|
|
29
|
+
readonly responses: {
|
|
30
|
+
readonly [status: number]: z.ZodTypeAny
|
|
31
|
+
readonly default: z.ZodTypeAny
|
|
32
|
+
}
|
|
33
|
+
readonly errors: {
|
|
34
|
+
readonly [status: number]: z.ZodTypeAny
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type OperationsMap = Record<string, OperationSchema>
|
|
39
|
+
|
|
21
40
|
export const operations = {
|
|
22
41
|
listPets: {
|
|
23
42
|
request: undefined,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { usePlugin, usePluginManager } from '@kubb/core/hooks'
|
|
1
2
|
import { createReactGenerator } from '@kubb/plugin-oas'
|
|
2
3
|
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
3
4
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
4
|
-
import { File
|
|
5
|
-
import { Operations } from '../components/Operations'
|
|
5
|
+
import { File } from '@kubb/react'
|
|
6
|
+
import { Operations } from '../components/Operations.tsx'
|
|
6
7
|
import type { PluginZod } from '../types'
|
|
7
8
|
|
|
8
9
|
export const operationsGenerator = createReactGenerator<PluginZod>({
|
|
9
10
|
name: 'operations',
|
|
10
11
|
Operations({ operations }) {
|
|
11
12
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = useApp<PluginZod>()
|
|
13
|
+
key: pluginKey,
|
|
14
|
+
options: { output, importPath },
|
|
15
|
+
} = usePlugin<PluginZod>()
|
|
16
|
+
const pluginManager = usePluginManager()
|
|
17
|
+
|
|
18
18
|
const oas = useOas()
|
|
19
19
|
const { getFile, groupSchemasByName } = useOperationManager()
|
|
20
20
|
|
|
@@ -39,6 +39,7 @@ export const operationsGenerator = createReactGenerator<PluginZod>({
|
|
|
39
39
|
banner={getBanner({ oas, output, config: pluginManager.config })}
|
|
40
40
|
footer={getFooter({ oas, output })}
|
|
41
41
|
>
|
|
42
|
+
<File.Import isTypeOnly name={['z']} path={importPath} />
|
|
42
43
|
{imports}
|
|
43
44
|
<Operations name={name} operations={transformedOperations} />
|
|
44
45
|
</File>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { useMode, usePlugin, usePluginManager } from '@kubb/core/hooks'
|
|
1
2
|
import { createReactGenerator, type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'
|
|
2
3
|
import { Oas } from '@kubb/plugin-oas/components'
|
|
3
4
|
import { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'
|
|
4
5
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
5
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
6
|
-
import { File
|
|
7
|
+
import { File } from '@kubb/react'
|
|
7
8
|
import { Zod } from '../components'
|
|
8
9
|
import type { PluginZod } from '../types'
|
|
9
10
|
|
|
@@ -12,7 +13,10 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
12
13
|
Operation({ operation, options }) {
|
|
13
14
|
const { coercion: globalCoercion, inferred, typed, mapper, wrapOutput } = options
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const plugin = usePlugin<PluginZod>()
|
|
17
|
+
const mode = useMode()
|
|
18
|
+
const pluginManager = usePluginManager()
|
|
19
|
+
|
|
16
20
|
const oas = useOas()
|
|
17
21
|
const { getSchemas, getFile, getGroup } = useOperationManager()
|
|
18
22
|
const schemaManager = useSchemaManager()
|
|
@@ -103,11 +107,9 @@ export const zodGenerator = createReactGenerator<PluginZod>({
|
|
|
103
107
|
|
|
104
108
|
const { getName, getFile, getImports } = useSchemaManager()
|
|
105
109
|
const {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
} = useApp<PluginZod>()
|
|
110
|
+
options: { output, emptySchemaType },
|
|
111
|
+
} = usePlugin<PluginZod>()
|
|
112
|
+
const pluginManager = usePluginManager()
|
|
111
113
|
const oas = useOas()
|
|
112
114
|
|
|
113
115
|
const imports = getImports(schema.tree)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-Btq9ngUK.js","names":["order: string[]","name","value","parserZod.sort","parserZod.parse"],"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"sourcesContent":["import type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props) {\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={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'\nimport type { SchemaObject } from '@kubb/oas'\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\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number) => {\n return [coercion ? 'z.coerce.number()' : 'z.number()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number, version: '3' | '4' = '3') => {\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 ]\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) => {\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) => {\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') => {\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) => {\n return [\n coercion ? '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) => {\n return [\n coercion ? '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) => {\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 = '') => `.describe(${value})`,\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) => (coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`),\n email: (coercion?: boolean, version: '3' | '4' = '3', min?: number, max?: number) => {\n return [\n coercion ? '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, version: '3' | '4' = '3') => {\n if (!value) {\n return undefined\n }\n\n return version === '4' ? value : `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string) => (value ? `.catchall(${value})` : undefined),\n name: 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\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 name: string\n typeName?: string\n description?: string\n keysToOmit?: string[]\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n rawSchema: SchemaObject\n version: '3' | '4'\n}\n\nexport function parse({ 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({ parent, name: 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((schema, _index, siblings) => parse({ parent: current, name: name, current: schema, 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((schema: Schema, _index, siblings) => parse({ parent: current, name: name, current: schema, 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((schemas, _index, siblings) => parse({ parent: current, name: name, current: schemas, siblings }, options))\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\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({ parent: current, name: 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((schema, _index, siblings) => {\n return parse({ parent: current, name: name, current: schema, 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 return zodKeywordMapper.ref(current.args?.name, options.version)\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(([name, 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\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return `\"${name}\": ${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((schema) => parse({ parent: current, name, current: schema, siblings: schemas }, options))\n .filter(Boolean)\n .join('')\n\n const objectValue = options.wrapOutput\n ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput\n : baseSchemaOutput\n\n if (options.version === '4' && SchemaGenerator.find(schemas, schemaKeywords.ref)) {\n // both optional and nullable\n if (isNullish) {\n return `get \"${name}\"(){\n return ${zodKeywordMapper.nullish(objectValue)}\n }`\n }\n\n // undefined\n if (isOptional) {\n return `get \"${name}\"(){\n return ${zodKeywordMapper.optional(objectValue)}\n }`\n }\n\n // null\n if (isNullable) {\n return `get \"${name}\"(){\n return ${zodKeywordMapper.nullable(objectValue)}\n }`\n }\n\n return `get \"${name}\"(){\n return ${objectValue}\n }`\n }\n\n // both optional and nullable\n if (isNullish) {\n return `\"${name}\": ${objectValue}${zodKeywordMapper.nullish()}`\n }\n\n // undefined\n if (isOptional) {\n return `\"${name}\": ${zodKeywordMapper.optional(objectValue)}`\n }\n\n // null\n if (isNullable) {\n return `\"${name}\": ${zodKeywordMapper.nullable(objectValue)}`\n }\n\n return `\"${name}\": ${objectValue}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((schema, _index, siblings) => parse({ parent: current, name: name, current: schema, 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) : 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((schema, _index, siblings) => parse({ parent: current, name: name, current: schema, 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'))\n }\n }\n\n if (isKeyword(current, schemaKeywords.default)) {\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()))\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)\n }\n\n if (isKeyword(current, schemaKeywords.uuid)) {\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'), options.version)\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)\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)\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 return zodKeywordMapper.number(shouldCoerce(options.coercion, 'numbers'), minSchema?.args, maxSchema?.args)\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 return zodKeywordMapper.integer(shouldCoerce(options.coercion, 'numbers'), minSchema?.args, maxSchema?.args, options.version)\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version)\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'\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 rawSchema: 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}\n\nexport function Zod({\n name,\n typeName,\n tree,\n rawSchema,\n inferTypeName,\n mapper,\n coercion,\n keysToOmit,\n description,\n wrapOutput,\n version,\n emptySchemaType,\n}: Props) {\n const hasTuple = !!SchemaGenerator.deepSearch(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 const output = schemas\n .map((schema, index) => {\n const siblings = schemas.filter((_, i) => i !== index)\n\n return parserZod.parse(\n { parent: undefined, current: schema, siblings },\n { name, keysToOmit, typeName, description, mapper, coercion, wrapOutput, rawSchema, version },\n )\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 (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 {\n if (firstSchema && isKeyword(firstSchema, schemaKeywords.ref) && version === '3') {\n suffix = '.schema'\n }\n }\n\n const emptyValue = parserZod.parse(\n {\n parent: undefined,\n current: {\n keyword: schemaKeywords[emptySchemaType],\n },\n siblings: [],\n },\n { name, keysToOmit, typeName, description, mapper, coercion, wrapOutput, rawSchema, version },\n )\n\n const baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}.omit({ ${keysToOmit.map((key) => `'${key}': true`).join(',')} })` : undefined].filter(Boolean).join('') ||\n emptyValue ||\n ''\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema: rawSchema }) || 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,cAAqB;CACtD,MAAM,iBAAiB,WAAW,QAC/B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,gBAAgB,CAAC,MAAM,IAAI;AAElD,SAAO;IAET,EAAE,CACH;CAED,MAAM,YAAY,WAAW,QAC1B,MAAM,QAAQ;AACb,OAAK,IAAI,IAAI,UAAU,KAAK,MAAM;GAChC,GAAI,KAAK,IAAI,IAAI,UAAU,KAAK,OAAQ,EAAE;IACzC,IAAI,UAAU,SAAS,eAAe,IAAI,UAAU,gBAAgB,CAAC;GACvE;AAED,SAAO;IAET,EAAE,CACH;AAED,QACE,4CACE,oBAAC,KAAK;EAAa;EAAM;EAAa;YACpC,oBAAC;GAAM;GAAa;GAAM;aACvB,IAAI,aAAa,gBAAgB,eAAe,CAAC;IAC5C;GACI,EACd,oBAAC,KAAK;EAAO,MAAM;EAAS;EAAa;YACvC,oBAAC;GAAM;GAAO,MAAM;GAAS;aAC1B,IAAI,aAAa,gBAAgB,UAAU,CAAC;IACvC;GACI,IACb;;;;;ACpCP,MAAM,mBAAmB;CACvB,WAAW;CACX,eAAe;CACf,YAAY;CACZ,SAAS,UAAoB,KAAc,QAAiB;AAC1D,SAAO;GAAC,WAAW,sBAAsB;GAAc,QAAQ,SAAY,QAAQ,IAAI,KAAK;GAAW,QAAQ,SAAY,QAAQ,IAAI,KAAK;GAAU,CACnJ,OAAO,QAAQ,CACf,KAAK,GAAG;;CAEb,UAAU,UAAoB,KAAc,KAAc,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