@kubb/plugin-zod 3.0.0-alpha.3 → 3.0.0-alpha.30

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 (85) hide show
  1. package/README.md +13 -4
  2. package/dist/chunk-3ST47CH3.js +237 -0
  3. package/dist/chunk-3ST47CH3.js.map +1 -0
  4. package/dist/chunk-FLFW72FT.cjs +344 -0
  5. package/dist/chunk-FLFW72FT.cjs.map +1 -0
  6. package/dist/chunk-RSWFWAY4.cjs +246 -0
  7. package/dist/chunk-RSWFWAY4.cjs.map +1 -0
  8. package/dist/chunk-UONLSRDV.js +337 -0
  9. package/dist/chunk-UONLSRDV.js.map +1 -0
  10. package/dist/components.cjs +11 -6
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +20 -19
  13. package/dist/components.d.ts +20 -19
  14. package/dist/components.js +2 -10
  15. package/dist/components.js.map +1 -1
  16. package/dist/generators.cjs +17 -0
  17. package/dist/generators.cjs.map +1 -0
  18. package/dist/generators.d.cts +10 -0
  19. package/dist/generators.d.ts +10 -0
  20. package/dist/generators.js +4 -0
  21. package/dist/generators.js.map +1 -0
  22. package/dist/index.cjs +12 -4
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +4 -137
  25. package/dist/index.d.ts +4 -137
  26. package/dist/index.js +3 -8
  27. package/dist/index.js.map +1 -1
  28. package/dist/types-mos5lUbD.d.cts +113 -0
  29. package/dist/types-mos5lUbD.d.ts +113 -0
  30. package/package.json +19 -21
  31. package/src/components/Operations.tsx +19 -103
  32. package/src/components/Zod.tsx +66 -0
  33. package/src/components/index.ts +1 -2
  34. package/src/generators/__snapshots__/anyof.ts +3 -0
  35. package/src/generators/__snapshots__/createPet.ts +15 -0
  36. package/src/generators/__snapshots__/createPetWithUnknownTypeAny.ts +13 -0
  37. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +15 -0
  38. package/src/generators/__snapshots__/deletePet.ts +3 -0
  39. package/src/generators/__snapshots__/discriminator.ts +3 -0
  40. package/src/generators/__snapshots__/enumBooleanLiteral.ts +3 -0
  41. package/src/generators/__snapshots__/enumNamesType.ts +3 -0
  42. package/src/generators/__snapshots__/enumNullable.ts +3 -0
  43. package/src/generators/__snapshots__/enumSingleLiteral.ts +3 -0
  44. package/src/generators/__snapshots__/enumVarNamesType.ts +3 -0
  45. package/src/generators/__snapshots__/example.ts +3 -0
  46. package/src/generators/__snapshots__/getPets.ts +18 -0
  47. package/src/generators/__snapshots__/mixedValueTypeConst.ts +6 -0
  48. package/src/generators/__snapshots__/nullableString.ts +3 -0
  49. package/src/generators/__snapshots__/nullableStringUuid.ts +3 -0
  50. package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +3 -0
  51. package/src/generators/__snapshots__/numberValueConst.ts +6 -0
  52. package/src/generators/__snapshots__/oneof.ts +3 -0
  53. package/src/generators/__snapshots__/operations.ts +46 -0
  54. package/src/generators/__snapshots__/optionalPetInfer.ts +5 -0
  55. package/src/generators/__snapshots__/optionalPetTyped.ts +3 -0
  56. package/src/generators/__snapshots__/order.ts +3 -0
  57. package/src/generators/__snapshots__/orderDateTyeString.ts +10 -0
  58. package/src/generators/__snapshots__/orderDateTypeFalse.ts +3 -0
  59. package/src/generators/__snapshots__/orderDateTypeString.ts +3 -0
  60. package/src/generators/__snapshots__/pet.ts +3 -0
  61. package/src/generators/__snapshots__/petArray.ts +6 -0
  62. package/src/generators/__snapshots__/petCoercion.ts +3 -0
  63. package/src/generators/__snapshots__/petTupleObject.ts +6 -0
  64. package/src/generators/__snapshots__/petWithMapper.ts +3 -0
  65. package/src/generators/__snapshots__/pets.ts +3 -0
  66. package/src/generators/__snapshots__/recursive.ts +3 -0
  67. package/src/generators/__snapshots__/showPetById.ts +18 -0
  68. package/src/generators/__snapshots__/stringValueConst.ts +6 -0
  69. package/src/generators/__snapshots__/uuidSchema.ts +3 -0
  70. package/src/generators/index.ts +2 -0
  71. package/src/generators/operationsGenerator.tsx +39 -0
  72. package/src/generators/zodGenerator.tsx +121 -0
  73. package/src/parser/index.ts +34 -10
  74. package/src/plugin.ts +21 -38
  75. package/src/types.ts +41 -69
  76. package/dist/Operations-BlQtRP31.d.cts +0 -47
  77. package/dist/Operations-BlQtRP31.d.ts +0 -47
  78. package/dist/chunk-7X3NWYUN.cjs +0 -1242
  79. package/dist/chunk-7X3NWYUN.cjs.map +0 -1
  80. package/dist/chunk-XCGVHLYD.js +0 -1242
  81. package/dist/chunk-XCGVHLYD.js.map +0 -1
  82. package/src/SchemaGenerator.tsx +0 -22
  83. package/src/components/OperationSchema.tsx +0 -64
  84. package/src/components/Schema.tsx +0 -162
  85. package/src/components/__snapshots__/operations.ts +0 -50
package/dist/index.d.cts CHANGED
@@ -1,142 +1,9 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
3
- import * as KubbFile from '@kubb/fs/types';
4
- import { SchemaObject } from '@kubb/oas';
5
- import { ResolvePathOptions, Exclude, Include, Override, Schema } from '@kubb/plugin-oas';
6
- import { O as Operations } from './Operations-BlQtRP31.cjs';
7
- import '@kubb/react';
8
- import 'react';
9
-
10
- type Templates = {
11
- operations?: typeof Operations.templates | false;
12
- };
13
- type Options = {
14
- output?: {
15
- /**
16
- * Relative path to save the Zod schemas.
17
- * When output is a file it will save all models inside that file else it will create a file per schema item.
18
- * @default 'zod'
19
- */
20
- path: string;
21
- /**
22
- * Name to be used for the `export * as {{exportAs}} from './'`
23
- */
24
- exportAs?: string;
25
- /**
26
- * Add an extension to the generated imports and exports, default it will not use an extension
27
- */
28
- extName?: KubbFile.Extname;
29
- /**
30
- * Define what needs to exported, here you can also disable the export of barrel files
31
- * @default `'barrel'`
32
- */
33
- exportType?: 'barrel' | 'barrelNamed' | false;
34
- };
35
- /**
36
- * Group the Zod schemas based on the provided name.
37
- */
38
- group?: {
39
- /**
40
- * Tag will group based on the operation tag inside the Swagger file
41
- */
42
- type: 'tag';
43
- /**
44
- * Relative path to save the grouped Zod schemas.
45
- *
46
- * `{{tag}}` will be replaced by the current tagName.
47
- * @example `${output}/{{tag}}Controller` => `zod/PetController`
48
- * @default `${output}/{{tag}}Controller`
49
- */
50
- output?: string;
51
- /**
52
- * Name to be used for the `export * as {{exportAs}} from './`
53
- * @default `"{{tag}}Schemas"`
54
- */
55
- exportAs?: string;
56
- };
57
- /**
58
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
59
- */
60
- exclude?: Array<Exclude>;
61
- /**
62
- * Array containing include parameters to include tags/operations/methods/paths.
63
- */
64
- include?: Array<Include>;
65
- /**
66
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
67
- */
68
- override?: Array<Override<ResolvedOptions>>;
69
- transformers?: {
70
- /**
71
- * Customize the names based on the type that is provided by the plugin.
72
- */
73
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
74
- /**
75
- * Receive schema and baseName(propertName) and return FakerMeta array
76
- * TODO TODO add docs
77
- * @beta
78
- */
79
- schema?: (props: {
80
- schema?: SchemaObject;
81
- name?: string;
82
- parentName?: string;
83
- }, defaultSchemas: Schema[]) => Schema[] | undefined;
84
- };
85
- mapper?: Record<string, string>;
86
- /**
87
- * Make it possible to override one of the templates
88
- */
89
- templates?: Partial<Templates>;
90
- /**
91
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
92
- * False will fallback on a simple z.string() format
93
- * @default 'string' 'stringOffset' will become the default in Kubb v3
94
- */
95
- dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
96
- /**
97
- * Which type to use when the Swagger/OpenAPI file is not providing more information
98
- * @default 'any'
99
- */
100
- unknownType?: 'any' | 'unknown';
101
- /**
102
- * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
103
- */
104
- typed?: boolean;
105
- /**
106
- * Return Zod generated schema as type with z.infer<TYPE>
107
- */
108
- typedSchema?: boolean;
109
- /**
110
- * Use of z.coerce.string() instead of z.string()
111
- */
112
- coercion?: boolean;
113
- /**
114
- * Path to Zod
115
- * It will be used as `import { z } from '${importPath}'`.
116
- * It allows both relative and absolute path.
117
- * the path will be applied as is, so relative path should be based on the file being generated.
118
- * @default 'zod'
119
- */
120
- importPath?: string;
121
- };
122
- type ResolvedOptions = {
123
- extName: KubbFile.Extname | undefined;
124
- transformers: NonNullable<Options['transformers']>;
125
- exclude: Options['exclude'];
126
- include: Options['include'];
127
- override: Options['override'];
128
- dateType: NonNullable<Options['dateType']>;
129
- unknownType: NonNullable<Options['unknownType']>;
130
- typed: NonNullable<Options['typed']>;
131
- typedSchema: NonNullable<Options['typedSchema']>;
132
- templates: NonNullable<Templates>;
133
- mapper: NonNullable<Options['mapper']>;
134
- importPath: NonNullable<Options['importPath']>;
135
- coercion: NonNullable<Options['coercion']>;
136
- };
137
- type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
2
+ import { O as Options, P as PluginZod } from './types-mos5lUbD.cjs';
3
+ import '@kubb/oas';
4
+ import '@kubb/plugin-oas';
138
5
 
139
6
  declare const pluginZodName = "plugin-zod";
140
7
  declare const pluginZod: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginZod>;
141
8
 
142
- export { type PluginZod, pluginZod, pluginZodName };
9
+ export { PluginZod, pluginZod, pluginZodName };
package/dist/index.d.ts CHANGED
@@ -1,142 +1,9 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
3
- import * as KubbFile from '@kubb/fs/types';
4
- import { SchemaObject } from '@kubb/oas';
5
- import { ResolvePathOptions, Exclude, Include, Override, Schema } from '@kubb/plugin-oas';
6
- import { O as Operations } from './Operations-BlQtRP31.js';
7
- import '@kubb/react';
8
- import 'react';
9
-
10
- type Templates = {
11
- operations?: typeof Operations.templates | false;
12
- };
13
- type Options = {
14
- output?: {
15
- /**
16
- * Relative path to save the Zod schemas.
17
- * When output is a file it will save all models inside that file else it will create a file per schema item.
18
- * @default 'zod'
19
- */
20
- path: string;
21
- /**
22
- * Name to be used for the `export * as {{exportAs}} from './'`
23
- */
24
- exportAs?: string;
25
- /**
26
- * Add an extension to the generated imports and exports, default it will not use an extension
27
- */
28
- extName?: KubbFile.Extname;
29
- /**
30
- * Define what needs to exported, here you can also disable the export of barrel files
31
- * @default `'barrel'`
32
- */
33
- exportType?: 'barrel' | 'barrelNamed' | false;
34
- };
35
- /**
36
- * Group the Zod schemas based on the provided name.
37
- */
38
- group?: {
39
- /**
40
- * Tag will group based on the operation tag inside the Swagger file
41
- */
42
- type: 'tag';
43
- /**
44
- * Relative path to save the grouped Zod schemas.
45
- *
46
- * `{{tag}}` will be replaced by the current tagName.
47
- * @example `${output}/{{tag}}Controller` => `zod/PetController`
48
- * @default `${output}/{{tag}}Controller`
49
- */
50
- output?: string;
51
- /**
52
- * Name to be used for the `export * as {{exportAs}} from './`
53
- * @default `"{{tag}}Schemas"`
54
- */
55
- exportAs?: string;
56
- };
57
- /**
58
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
59
- */
60
- exclude?: Array<Exclude>;
61
- /**
62
- * Array containing include parameters to include tags/operations/methods/paths.
63
- */
64
- include?: Array<Include>;
65
- /**
66
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
67
- */
68
- override?: Array<Override<ResolvedOptions>>;
69
- transformers?: {
70
- /**
71
- * Customize the names based on the type that is provided by the plugin.
72
- */
73
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
74
- /**
75
- * Receive schema and baseName(propertName) and return FakerMeta array
76
- * TODO TODO add docs
77
- * @beta
78
- */
79
- schema?: (props: {
80
- schema?: SchemaObject;
81
- name?: string;
82
- parentName?: string;
83
- }, defaultSchemas: Schema[]) => Schema[] | undefined;
84
- };
85
- mapper?: Record<string, string>;
86
- /**
87
- * Make it possible to override one of the templates
88
- */
89
- templates?: Partial<Templates>;
90
- /**
91
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
92
- * False will fallback on a simple z.string() format
93
- * @default 'string' 'stringOffset' will become the default in Kubb v3
94
- */
95
- dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
96
- /**
97
- * Which type to use when the Swagger/OpenAPI file is not providing more information
98
- * @default 'any'
99
- */
100
- unknownType?: 'any' | 'unknown';
101
- /**
102
- * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
103
- */
104
- typed?: boolean;
105
- /**
106
- * Return Zod generated schema as type with z.infer<TYPE>
107
- */
108
- typedSchema?: boolean;
109
- /**
110
- * Use of z.coerce.string() instead of z.string()
111
- */
112
- coercion?: boolean;
113
- /**
114
- * Path to Zod
115
- * It will be used as `import { z } from '${importPath}'`.
116
- * It allows both relative and absolute path.
117
- * the path will be applied as is, so relative path should be based on the file being generated.
118
- * @default 'zod'
119
- */
120
- importPath?: string;
121
- };
122
- type ResolvedOptions = {
123
- extName: KubbFile.Extname | undefined;
124
- transformers: NonNullable<Options['transformers']>;
125
- exclude: Options['exclude'];
126
- include: Options['include'];
127
- override: Options['override'];
128
- dateType: NonNullable<Options['dateType']>;
129
- unknownType: NonNullable<Options['unknownType']>;
130
- typed: NonNullable<Options['typed']>;
131
- typedSchema: NonNullable<Options['typedSchema']>;
132
- templates: NonNullable<Templates>;
133
- mapper: NonNullable<Options['mapper']>;
134
- importPath: NonNullable<Options['importPath']>;
135
- coercion: NonNullable<Options['coercion']>;
136
- };
137
- type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
2
+ import { O as Options, P as PluginZod } from './types-mos5lUbD.js';
3
+ import '@kubb/oas';
4
+ import '@kubb/plugin-oas';
138
5
 
139
6
  declare const pluginZodName = "plugin-zod";
140
7
  declare const pluginZod: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginZod>;
141
8
 
142
- export { type PluginZod, pluginZod, pluginZodName };
9
+ export { PluginZod, pluginZod, pluginZodName };
package/dist/index.js CHANGED
@@ -1,9 +1,4 @@
1
- import {
2
- pluginZod,
3
- pluginZodName
4
- } from "./chunk-XCGVHLYD.js";
5
- export {
6
- pluginZod,
7
- pluginZodName
8
- };
1
+ export { pluginZod, pluginZodName } from './chunk-3ST47CH3.js';
2
+ import './chunk-UONLSRDV.js';
3
+ //# sourceMappingURL=index.js.map
9
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,113 @@
1
+ import { PluginFactoryOptions, Output, ResolveNameParams } from '@kubb/core';
2
+ import { SchemaObject } from '@kubb/oas';
3
+ import { ResolvePathOptions, Exclude, Include, Override, Schema, Generator } from '@kubb/plugin-oas';
4
+
5
+ type Options = {
6
+ /**
7
+ * @default 'zod'
8
+ */
9
+ output?: Output;
10
+ /**
11
+ * Group the Zod schemas based on the provided name.
12
+ */
13
+ group?: {
14
+ /**
15
+ * Tag will group based on the operation tag inside the Swagger file
16
+ */
17
+ type: 'tag';
18
+ /**
19
+ * Relative path to save the grouped Zod schemas.
20
+ *
21
+ * `{{tag}}` will be replaced by the current tagName.
22
+ * @example `${output}/{{tag}}Controller` => `zod/PetController`
23
+ * @default `${output}/{{tag}}Controller`
24
+ */
25
+ output?: string;
26
+ /**
27
+ * Name to be used for the `export * as {{exportAs}} from './`
28
+ * @default `"{{tag}}Schemas"`
29
+ */
30
+ exportAs?: string;
31
+ };
32
+ /**
33
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
34
+ */
35
+ exclude?: Array<Exclude>;
36
+ /**
37
+ * Array containing include parameters to include tags/operations/methods/paths.
38
+ */
39
+ include?: Array<Include>;
40
+ /**
41
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
42
+ */
43
+ override?: Array<Override<ResolvedOptions>>;
44
+ /**
45
+ * Path to Zod
46
+ * It will be used as `import { z } from '${importPath}'`.
47
+ * It allows both relative and absolute path.
48
+ * the path will be applied as is, so relative path should be based on the file being generated.
49
+ * @default 'zod'
50
+ */
51
+ importPath?: string;
52
+ /**
53
+ * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
54
+ * False will fallback on a simple z.string() format
55
+ * @default 'string' 'stringOffset' will become the default in Kubb v3
56
+ */
57
+ dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
58
+ /**
59
+ * Which type to use when the Swagger/OpenAPI file is not providing more information
60
+ * @default 'any'
61
+ */
62
+ unknownType?: 'any' | 'unknown';
63
+ /**
64
+ * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
65
+ */
66
+ typed?: boolean;
67
+ /**
68
+ * Return Zod generated schema as type with z.infer<TYPE>
69
+ */
70
+ inferred?: boolean;
71
+ /**
72
+ * Use of z.coerce.string() instead of z.string()
73
+ */
74
+ coercion?: boolean;
75
+ operations?: boolean;
76
+ mapper?: Record<string, string>;
77
+ transformers?: {
78
+ /**
79
+ * Customize the names based on the type that is provided by the plugin.
80
+ */
81
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
82
+ /**
83
+ * Receive schema and baseName(propertName) and return FakerMeta array
84
+ * TODO TODO add docs
85
+ * @beta
86
+ */
87
+ schema?: (props: {
88
+ schema?: SchemaObject;
89
+ name?: string;
90
+ parentName?: string;
91
+ }, defaultSchemas: Schema[]) => Schema[] | undefined;
92
+ };
93
+ /**
94
+ * Define some generators next to the zod generators
95
+ */
96
+ generators?: Array<Generator<PluginZod>>;
97
+ };
98
+ type ResolvedOptions = {
99
+ output: Output;
100
+ override: NonNullable<Options['override']>;
101
+ transformers: NonNullable<Options['transformers']>;
102
+ dateType: NonNullable<Options['dateType']>;
103
+ unknownType: NonNullable<Options['unknownType']>;
104
+ typed: NonNullable<Options['typed']>;
105
+ inferred: NonNullable<Options['inferred']>;
106
+ mapper: NonNullable<Options['mapper']>;
107
+ importPath: NonNullable<Options['importPath']>;
108
+ coercion: NonNullable<Options['coercion']>;
109
+ operations: NonNullable<Options['coercion']>;
110
+ };
111
+ type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
112
+
113
+ export type { Options as O, PluginZod as P };
@@ -0,0 +1,113 @@
1
+ import { PluginFactoryOptions, Output, ResolveNameParams } from '@kubb/core';
2
+ import { SchemaObject } from '@kubb/oas';
3
+ import { ResolvePathOptions, Exclude, Include, Override, Schema, Generator } from '@kubb/plugin-oas';
4
+
5
+ type Options = {
6
+ /**
7
+ * @default 'zod'
8
+ */
9
+ output?: Output;
10
+ /**
11
+ * Group the Zod schemas based on the provided name.
12
+ */
13
+ group?: {
14
+ /**
15
+ * Tag will group based on the operation tag inside the Swagger file
16
+ */
17
+ type: 'tag';
18
+ /**
19
+ * Relative path to save the grouped Zod schemas.
20
+ *
21
+ * `{{tag}}` will be replaced by the current tagName.
22
+ * @example `${output}/{{tag}}Controller` => `zod/PetController`
23
+ * @default `${output}/{{tag}}Controller`
24
+ */
25
+ output?: string;
26
+ /**
27
+ * Name to be used for the `export * as {{exportAs}} from './`
28
+ * @default `"{{tag}}Schemas"`
29
+ */
30
+ exportAs?: string;
31
+ };
32
+ /**
33
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
34
+ */
35
+ exclude?: Array<Exclude>;
36
+ /**
37
+ * Array containing include parameters to include tags/operations/methods/paths.
38
+ */
39
+ include?: Array<Include>;
40
+ /**
41
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
42
+ */
43
+ override?: Array<Override<ResolvedOptions>>;
44
+ /**
45
+ * Path to Zod
46
+ * It will be used as `import { z } from '${importPath}'`.
47
+ * It allows both relative and absolute path.
48
+ * the path will be applied as is, so relative path should be based on the file being generated.
49
+ * @default 'zod'
50
+ */
51
+ importPath?: string;
52
+ /**
53
+ * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
54
+ * False will fallback on a simple z.string() format
55
+ * @default 'string' 'stringOffset' will become the default in Kubb v3
56
+ */
57
+ dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
58
+ /**
59
+ * Which type to use when the Swagger/OpenAPI file is not providing more information
60
+ * @default 'any'
61
+ */
62
+ unknownType?: 'any' | 'unknown';
63
+ /**
64
+ * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
65
+ */
66
+ typed?: boolean;
67
+ /**
68
+ * Return Zod generated schema as type with z.infer<TYPE>
69
+ */
70
+ inferred?: boolean;
71
+ /**
72
+ * Use of z.coerce.string() instead of z.string()
73
+ */
74
+ coercion?: boolean;
75
+ operations?: boolean;
76
+ mapper?: Record<string, string>;
77
+ transformers?: {
78
+ /**
79
+ * Customize the names based on the type that is provided by the plugin.
80
+ */
81
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
82
+ /**
83
+ * Receive schema and baseName(propertName) and return FakerMeta array
84
+ * TODO TODO add docs
85
+ * @beta
86
+ */
87
+ schema?: (props: {
88
+ schema?: SchemaObject;
89
+ name?: string;
90
+ parentName?: string;
91
+ }, defaultSchemas: Schema[]) => Schema[] | undefined;
92
+ };
93
+ /**
94
+ * Define some generators next to the zod generators
95
+ */
96
+ generators?: Array<Generator<PluginZod>>;
97
+ };
98
+ type ResolvedOptions = {
99
+ output: Output;
100
+ override: NonNullable<Options['override']>;
101
+ transformers: NonNullable<Options['transformers']>;
102
+ dateType: NonNullable<Options['dateType']>;
103
+ unknownType: NonNullable<Options['unknownType']>;
104
+ typed: NonNullable<Options['typed']>;
105
+ inferred: NonNullable<Options['inferred']>;
106
+ mapper: NonNullable<Options['mapper']>;
107
+ importPath: NonNullable<Options['importPath']>;
108
+ coercion: NonNullable<Options['coercion']>;
109
+ operations: NonNullable<Options['coercion']>;
110
+ };
111
+ type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
112
+
113
+ export type { Options as O, PluginZod as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-zod",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.30",
4
4
  "description": "Generator plugin-zod",
5
5
  "keywords": [
6
6
  "typescript",
@@ -25,14 +25,16 @@
25
25
  "require": "./dist/index.cjs",
26
26
  "default": "./dist/index.cjs"
27
27
  },
28
+ "./generators": {
29
+ "import": "./dist/generators.js",
30
+ "require": "./dist/generators.cjs",
31
+ "default": "./dist/generators.cjs"
32
+ },
28
33
  "./components": {
29
34
  "import": "./dist/components.js",
30
35
  "require": "./dist/components.cjs",
31
36
  "default": "./dist/components.cjs"
32
37
  },
33
- "./oas": {
34
- "types": "./dist/oas.d.ts"
35
- },
36
38
  "./package.json": "./package.json",
37
39
  "./*": "./*"
38
40
  },
@@ -44,8 +46,8 @@
44
46
  "components": [
45
47
  "./dist/components.d.ts"
46
48
  ],
47
- "oas": [
48
- "./dist/oas.d.ts"
49
+ "generators": [
50
+ "./dist/generators.d.ts"
49
51
  ]
50
52
  }
51
53
  },
@@ -56,25 +58,21 @@
56
58
  "!/**/__tests__/**"
57
59
  ],
58
60
  "dependencies": {
59
- "@kubb/core": "3.0.0-alpha.3",
60
- "@kubb/fs": "3.0.0-alpha.3",
61
- "@kubb/oas": "3.0.0-alpha.3",
62
- "@kubb/parser-ts": "3.0.0-alpha.3",
63
- "@kubb/plugin-oas": "3.0.0-alpha.3",
64
- "@kubb/react": "3.0.0-alpha.3",
65
- "@kubb/types": "3.0.0-alpha.3"
61
+ "@kubb/core": "3.0.0-alpha.30",
62
+ "@kubb/fs": "3.0.0-alpha.30",
63
+ "@kubb/oas": "3.0.0-alpha.30",
64
+ "@kubb/parser-ts": "3.0.0-alpha.30",
65
+ "@kubb/plugin-oas": "3.0.0-alpha.30",
66
+ "@kubb/plugin-ts": "3.0.0-alpha.30",
67
+ "@kubb/react": "3.0.0-alpha.30"
66
68
  },
67
69
  "devDependencies": {
68
- "@types/react": "^18.3.4",
69
- "prettier": "^3.3.3",
70
- "react": "^18.3.1",
71
- "tsup": "^8.2.4",
72
- "@kubb/config-biome": "3.0.0-alpha.3",
73
- "@kubb/config-ts": "3.0.0-alpha.3",
74
- "@kubb/config-tsup": "3.0.0-alpha.3"
70
+ "tsup": "^8.3.0",
71
+ "@kubb/config-ts": "3.0.0-alpha.30",
72
+ "@kubb/config-tsup": "3.0.0-alpha.30"
75
73
  },
76
74
  "peerDependencies": {
77
- "@kubb/react": "3.0.0-alpha.3"
75
+ "@kubb/react": "3.0.0-alpha.30"
78
76
  },
79
77
  "engines": {
80
78
  "node": ">=20"