@kubb/plugin-zod 4.31.0 → 4.31.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.d.ts +4 -4
- package/dist/generators.d.ts +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/templates/ToZod.source.d.ts +1 -1
- package/package.json +6 -6
- package/dist/types-Cfvq128m.d.ts +0 -172
package/dist/components.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginZod } from "./types-
|
|
3
|
-
import {
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { n as PluginZod } from "./types-B-1DRHH9.js";
|
|
3
|
+
import { Schema } from "@kubb/plugin-oas";
|
|
4
4
|
import { SchemaNames } from "@kubb/plugin-oas/hooks";
|
|
5
|
+
import { Operation, SchemaObject } from "@kubb/oas";
|
|
5
6
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
6
|
-
import { Schema } from "@kubb/plugin-oas";
|
|
7
7
|
|
|
8
8
|
//#region src/components/Operations.d.ts
|
|
9
9
|
type Props$1 = {
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginZod } from "./types-
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { n as PluginZod } from "./types-B-1DRHH9.js";
|
|
3
|
+
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
4
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
3
5
|
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
4
6
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
|
-
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
6
7
|
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
7
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-oas/src/types.d.ts
|
|
11
11
|
type GetOasOptions = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginZod, t as Options } from "./types-
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { n as PluginZod, t as Options } from "./types-B-1DRHH9.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-zod",
|
|
3
|
-
"version": "4.31.
|
|
3
|
+
"version": "4.31.2",
|
|
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",
|
|
@@ -77,12 +77,12 @@
|
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@kubb/react-fabric": "0.13.
|
|
80
|
+
"@kubb/react-fabric": "0.13.3",
|
|
81
81
|
"remeda": "^2.33.6",
|
|
82
|
-
"@kubb/core": "4.31.
|
|
83
|
-
"@kubb/
|
|
84
|
-
"@kubb/oas": "4.31.
|
|
85
|
-
"@kubb/plugin-ts": "4.31.
|
|
82
|
+
"@kubb/core": "4.31.2",
|
|
83
|
+
"@kubb/oas": "4.31.2",
|
|
84
|
+
"@kubb/plugin-oas": "4.31.2",
|
|
85
|
+
"@kubb/plugin-ts": "4.31.2"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@asteasolutions/zod-to-openapi": "^8.4.3",
|
package/dist/types-Cfvq128m.d.ts
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
-
import { Oas, SchemaObject, contentType } from "@kubb/oas";
|
|
3
|
-
import { Exclude, Include, Override, ResolvePathOptions, Schema } from "@kubb/plugin-oas";
|
|
4
|
-
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
5
|
-
import { Generator } from "@kubb/plugin-oas/generators";
|
|
6
|
-
|
|
7
|
-
//#region src/types.d.ts
|
|
8
|
-
type Options = {
|
|
9
|
-
/**
|
|
10
|
-
* @default 'zod'
|
|
11
|
-
*/
|
|
12
|
-
output?: Output<Oas>;
|
|
13
|
-
/**
|
|
14
|
-
* Define which contentType should be used.
|
|
15
|
-
* By default, the first JSON valid mediaType is used
|
|
16
|
-
*/
|
|
17
|
-
contentType?: contentType;
|
|
18
|
-
/**
|
|
19
|
-
* Group the Zod schemas based on the provided name.
|
|
20
|
-
*/
|
|
21
|
-
group?: Group;
|
|
22
|
-
/**
|
|
23
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
24
|
-
*/
|
|
25
|
-
exclude?: Array<Exclude>;
|
|
26
|
-
/**
|
|
27
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
28
|
-
*/
|
|
29
|
-
include?: Array<Include>;
|
|
30
|
-
/**
|
|
31
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
32
|
-
*/
|
|
33
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
34
|
-
/**
|
|
35
|
-
* Path to Zod
|
|
36
|
-
* It used as `import { z } from '${importPath}'`.
|
|
37
|
-
* Accepts relative and absolute paths.
|
|
38
|
-
* Path is used as-is; relative paths are based on the generated file location.
|
|
39
|
-
* @default 'zod'
|
|
40
|
-
*/
|
|
41
|
-
importPath?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Choose to use date or datetime as JavaScript Date instead of string.
|
|
44
|
-
* - false falls back to a simple z.string() format.
|
|
45
|
-
* - 'string' uses z.string().datetime() for datetime validation.
|
|
46
|
-
* - 'stringOffset' uses z.string().datetime({ offset: true }) for datetime with timezone offset validation.
|
|
47
|
-
* - 'stringLocal' uses z.string().datetime({ local: true }) for local datetime validation.
|
|
48
|
-
* - 'date' uses z.date() for JavaScript Date objects.
|
|
49
|
-
* @default 'string'
|
|
50
|
-
* @note 'stringOffset' will become the default in Kubb v3.
|
|
51
|
-
*/
|
|
52
|
-
dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
53
|
-
/**
|
|
54
|
-
* Choose to use `number` or `bigint` for integer fields with `int64` format.
|
|
55
|
-
* - 'number' uses the JavaScript `number` type (matches JSON.parse() runtime behavior).
|
|
56
|
-
* - 'bigint' uses the JavaScript `bigint` type (accurate for values exceeding Number.MAX_SAFE_INTEGER).
|
|
57
|
-
* @note in v5 of Kubb 'bigint' will become the default to better align with OpenAPI's int64 specification.
|
|
58
|
-
* @default 'number'
|
|
59
|
-
*/
|
|
60
|
-
integerType?: 'number' | 'bigint';
|
|
61
|
-
/**
|
|
62
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
63
|
-
* - 'any' allows any value.
|
|
64
|
-
* - 'unknown' requires type narrowing before use.
|
|
65
|
-
* - 'void' represents no value.
|
|
66
|
-
* @default 'any'
|
|
67
|
-
*/
|
|
68
|
-
unknownType?: 'any' | 'unknown' | 'void';
|
|
69
|
-
/**
|
|
70
|
-
* Which type to use for empty schema values.
|
|
71
|
-
* - 'any' allows any value.
|
|
72
|
-
* - 'unknown' requires type narrowing before use.
|
|
73
|
-
* - 'void' represents no value.
|
|
74
|
-
* @default `unknownType`
|
|
75
|
-
*/
|
|
76
|
-
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
77
|
-
/**
|
|
78
|
-
* Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
|
|
79
|
-
*/
|
|
80
|
-
typed?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Return Zod generated schema as type with z.infer<TYPE>
|
|
83
|
-
*/
|
|
84
|
-
inferred?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Use of z.coerce.string() instead of z.string()
|
|
87
|
-
* can also be an object to enable coercion for dates, strings, and numbers
|
|
88
|
-
*/
|
|
89
|
-
coercion?: boolean | {
|
|
90
|
-
dates?: boolean;
|
|
91
|
-
strings?: boolean;
|
|
92
|
-
numbers?: boolean;
|
|
93
|
-
};
|
|
94
|
-
operations?: boolean;
|
|
95
|
-
mapper?: Record<string, string>;
|
|
96
|
-
transformers?: {
|
|
97
|
-
/**
|
|
98
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
99
|
-
*/
|
|
100
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
101
|
-
/**
|
|
102
|
-
* Receive schema and baseName(propertyName) and return FakerMeta array
|
|
103
|
-
* TODO TODO add docs
|
|
104
|
-
* @beta
|
|
105
|
-
*/
|
|
106
|
-
schema?: (props: {
|
|
107
|
-
schema: SchemaObject | null;
|
|
108
|
-
name: string | null;
|
|
109
|
-
parentName: string | null;
|
|
110
|
-
}, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Which version of Zod should be used.
|
|
114
|
-
* - '3' uses Zod v3.x syntax and features.
|
|
115
|
-
* - '4' uses Zod v4.x syntax and features.
|
|
116
|
-
* @default '3'
|
|
117
|
-
*/
|
|
118
|
-
version?: '3' | '4';
|
|
119
|
-
/**
|
|
120
|
-
* Which Zod GUID validator to use for OpenAPI `format: uuid`.
|
|
121
|
-
* - 'uuid' uses UUID validation.
|
|
122
|
-
* - 'guid' uses GUID validation (Zod v4 only).
|
|
123
|
-
* @default 'uuid'
|
|
124
|
-
*/
|
|
125
|
-
guidType?: 'uuid' | 'guid';
|
|
126
|
-
/**
|
|
127
|
-
* Use Zod Mini's functional API for better tree-shaking support.
|
|
128
|
-
* When enabled, generates functional syntax (e.g., `z.optional(z.string())`) instead of chainable methods (e.g., `z.string().optional()`).
|
|
129
|
-
* Requires Zod v4 or later. When `mini: true`, `version` is set to '4' and `importPath` will default to 'zod/mini'.
|
|
130
|
-
* @default false
|
|
131
|
-
*/
|
|
132
|
-
mini?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Callback function to wrap the output of the generated zod schema
|
|
135
|
-
*
|
|
136
|
-
* This is useful for edge case scenarios where you might leverage something like `z.object({ ... }).openapi({ example: { some: "complex-example" }})`
|
|
137
|
-
* or `extendApi(z.object({ ... }), { example: { some: "complex-example", ...otherOpenApiProperties }})`
|
|
138
|
-
* while going from openapi -> zod -> openapi
|
|
139
|
-
*/
|
|
140
|
-
wrapOutput?: (arg: {
|
|
141
|
-
output: string;
|
|
142
|
-
schema: SchemaObject;
|
|
143
|
-
}) => string | undefined;
|
|
144
|
-
/**
|
|
145
|
-
* Define some generators next to the zod generators
|
|
146
|
-
*/
|
|
147
|
-
generators?: Array<Generator<PluginZod>>;
|
|
148
|
-
};
|
|
149
|
-
type ResolvedOptions = {
|
|
150
|
-
output: Output<Oas>;
|
|
151
|
-
group: Options['group'];
|
|
152
|
-
override: NonNullable<Options['override']>;
|
|
153
|
-
transformers: NonNullable<Options['transformers']>;
|
|
154
|
-
dateType: NonNullable<Options['dateType']>;
|
|
155
|
-
integerType: NonNullable<Options['integerType']>;
|
|
156
|
-
unknownType: NonNullable<Options['unknownType']>;
|
|
157
|
-
emptySchemaType: NonNullable<Options['emptySchemaType']>;
|
|
158
|
-
typed: NonNullable<Options['typed']>;
|
|
159
|
-
inferred: NonNullable<Options['inferred']>;
|
|
160
|
-
mapper: NonNullable<Options['mapper']>;
|
|
161
|
-
importPath: NonNullable<Options['importPath']>;
|
|
162
|
-
coercion: NonNullable<Options['coercion']>;
|
|
163
|
-
operations: NonNullable<Options['operations']>;
|
|
164
|
-
wrapOutput: Options['wrapOutput'];
|
|
165
|
-
version: NonNullable<Options['version']>;
|
|
166
|
-
guidType: NonNullable<Options['guidType']>;
|
|
167
|
-
mini: NonNullable<Options['mini']>;
|
|
168
|
-
};
|
|
169
|
-
type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
170
|
-
//#endregion
|
|
171
|
-
export { PluginZod as n, Options as t };
|
|
172
|
-
//# sourceMappingURL=types-Cfvq128m.d.ts.map
|