@kubb/plugin-zod 3.16.1 → 3.16.3

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 (47) hide show
  1. package/dist/components-CJ6RN1R2.js +414 -0
  2. package/dist/components-CJ6RN1R2.js.map +1 -0
  3. package/dist/components-GvkeO2ig.cjs +454 -0
  4. package/dist/components-GvkeO2ig.cjs.map +1 -0
  5. package/dist/components.cjs +3 -15
  6. package/dist/components.d.cts +56 -26
  7. package/dist/components.d.ts +56 -26
  8. package/dist/components.js +3 -3
  9. package/dist/generators-B13NknOz.cjs +265 -0
  10. package/dist/generators-B13NknOz.cjs.map +1 -0
  11. package/dist/generators-DcUZYcq0.js +254 -0
  12. package/dist/generators-DcUZYcq0.js.map +1 -0
  13. package/dist/generators.cjs +4 -16
  14. package/dist/generators.d.cts +8 -8
  15. package/dist/generators.d.ts +8 -8
  16. package/dist/generators.js +4 -4
  17. package/dist/index.cjs +103 -137
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +6 -7
  20. package/dist/index.d.ts +6 -7
  21. package/dist/index.js +103 -131
  22. package/dist/index.js.map +1 -1
  23. package/dist/types-B0UqdcbG.d.cts +1237 -0
  24. package/dist/types-YpNWeJUW.d.ts +1237 -0
  25. package/dist/utils.cjs +0 -4
  26. package/dist/utils.d.cts +18 -24
  27. package/dist/utils.d.ts +18 -24
  28. package/dist/utils.js +1 -3
  29. package/package.json +24 -30
  30. package/src/components/Zod.tsx +3 -2
  31. package/src/parser.ts +8 -0
  32. package/dist/chunk-AHCG4FYY.js +0 -448
  33. package/dist/chunk-AHCG4FYY.js.map +0 -1
  34. package/dist/chunk-QNMY34G2.cjs +0 -455
  35. package/dist/chunk-QNMY34G2.cjs.map +0 -1
  36. package/dist/chunk-RQAEGENA.cjs +0 -184
  37. package/dist/chunk-RQAEGENA.cjs.map +0 -1
  38. package/dist/chunk-Z6ERLJH7.js +0 -181
  39. package/dist/chunk-Z6ERLJH7.js.map +0 -1
  40. package/dist/components.cjs.map +0 -1
  41. package/dist/components.js.map +0 -1
  42. package/dist/generators.cjs.map +0 -1
  43. package/dist/generators.js.map +0 -1
  44. package/dist/types-BOF1ntMm.d.cts +0 -130
  45. package/dist/types-BOF1ntMm.d.ts +0 -130
  46. package/dist/utils.cjs.map +0 -1
  47. package/dist/utils.js.map +0 -1
@@ -1,130 +0,0 @@
1
- import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
2
- import { Oas, contentType, SchemaObject } from '@kubb/oas';
3
- import { Exclude, Include, Override, Schema, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
4
-
5
- type Options = {
6
- /**
7
- * @default 'zod'
8
- */
9
- output?: Output<Oas>;
10
- /**
11
- * Define which contentType should be used.
12
- * By default, the first JSON valid mediaType will be used
13
- */
14
- contentType?: contentType;
15
- /**
16
- * Group the Zod schemas based on the provided name.
17
- */
18
- group?: Group;
19
- /**
20
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
21
- */
22
- exclude?: Array<Exclude>;
23
- /**
24
- * Array containing include parameters to include tags/operations/methods/paths.
25
- */
26
- include?: Array<Include>;
27
- /**
28
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
29
- */
30
- override?: Array<Override<ResolvedOptions>>;
31
- /**
32
- * Path to Zod
33
- * It will be used as `import { z } from '${importPath}'`.
34
- * It allows both relative and absolute path.
35
- * the path will be applied as is, so relative path should be based on the file being generated.
36
- * @default 'zod'
37
- */
38
- importPath?: string;
39
- /**
40
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
41
- * False will fallback on a simple z.string() format
42
- * @default 'string' 'stringOffset' will become the default in Kubb v3
43
- */
44
- dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
45
- /**
46
- * Which type to use when the Swagger/OpenAPI file is not providing more information
47
- * @default 'any'
48
- */
49
- unknownType?: 'any' | 'unknown' | 'void';
50
- /**
51
- * Which type to use for empty schema values
52
- * @default `unknownType`
53
- */
54
- emptySchemaType?: 'any' | 'unknown' | 'void';
55
- /**
56
- * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
57
- */
58
- typed?: boolean;
59
- /**
60
- * Return Zod generated schema as type with z.infer<TYPE>
61
- */
62
- inferred?: boolean;
63
- /**
64
- * Use of z.coerce.string() instead of z.string()
65
- * can also be an object to enable coercion for dates, strings, and numbers
66
- */
67
- coercion?: boolean | {
68
- dates?: boolean;
69
- strings?: boolean;
70
- numbers?: boolean;
71
- };
72
- operations?: boolean;
73
- mapper?: Record<string, string>;
74
- transformers?: {
75
- /**
76
- * Customize the names based on the type that is provided by the plugin.
77
- */
78
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
79
- /**
80
- * Receive schema and baseName(propertName) and return FakerMeta array
81
- * TODO TODO add docs
82
- * @beta
83
- */
84
- schema?: (props: {
85
- schema?: SchemaObject;
86
- name?: string;
87
- parentName?: string;
88
- }, defaultSchemas: Schema[]) => Schema[] | undefined;
89
- };
90
- /**
91
- * Which version of Zod should be used
92
- * @default '3
93
- */
94
- version?: '3' | '4';
95
- /**
96
- * Callback function to wrap the output of the generated zod schema
97
- *
98
- * This is useful for edge case scenarios where you might leverage something like `z.object({ ... }).openapi({ example: { some: "complex-example" }})`
99
- * or `extendApi(z.object({ ... }), { example: { some: "complex-example", ...otherOpenApiProperties }})`
100
- * while going from openapi -> zod -> openapi
101
- */
102
- wrapOutput?: (arg: {
103
- output: string;
104
- schema: SchemaObject;
105
- }) => string | undefined;
106
- /**
107
- * Define some generators next to the zod generators
108
- */
109
- generators?: Array<Generator<PluginZod>>;
110
- };
111
- type ResolvedOptions = {
112
- output: Output<Oas>;
113
- group: Options['group'];
114
- override: NonNullable<Options['override']>;
115
- transformers: NonNullable<Options['transformers']>;
116
- dateType: NonNullable<Options['dateType']>;
117
- unknownType: NonNullable<Options['unknownType']>;
118
- emptySchemaType: NonNullable<Options['emptySchemaType']>;
119
- typed: NonNullable<Options['typed']>;
120
- inferred: NonNullable<Options['inferred']>;
121
- mapper: NonNullable<Options['mapper']>;
122
- importPath: NonNullable<Options['importPath']>;
123
- coercion: NonNullable<Options['coercion']>;
124
- operations: NonNullable<Options['operations']>;
125
- wrapOutput: Options['wrapOutput'];
126
- version: NonNullable<Options['version']>;
127
- };
128
- type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
129
-
130
- export type { Options as O, PluginZod as P };
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"utils.cjs"}
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"utils.js"}