@kubb/plugin-zod 5.4.5 → 5.4.6
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/OVERVIEW.md +20 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +204 -0
- package/package.json +7 -4
package/OVERVIEW.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Zod
|
|
2
|
+
|
|
3
|
+
Generates Zod v4 schemas from your OpenAPI spec. Use them to validate API responses, form input, and query params at runtime.
|
|
4
|
+
|
|
5
|
+
The schemas can stand on their own. With `inferred: true`, the plugin also exports a `z.infer` type next to each schema, so you can skip `@kubb/plugin-ts`. Client plugins such as `@kubb/plugin-fetch` and `@kubb/plugin-axios` use these schemas when you set their `validator` option.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Install Zod v4 or higher in the app that uses the generated code. No other plugins are needed.
|
|
10
|
+
|
|
11
|
+
## Options worth knowing
|
|
12
|
+
|
|
13
|
+
- `mini` generates Zod Mini schemas for smaller bundles, and switches `importPath` to `zod/mini`.
|
|
14
|
+
- `importPath` sets the module the files import `z` from. The default is `zod`.
|
|
15
|
+
- `inferred` exports a `z.infer` type alias next to each schema.
|
|
16
|
+
- `coercion` wraps schemas in `z.coerce`, so input is converted before validation. Pass an object to coerce only dates, strings, or numbers.
|
|
17
|
+
- `guidType` picks `z.uuid()` (default) or `z.guid()` for `format: uuid`.
|
|
18
|
+
- `regexType` writes a `pattern` as a regex literal (default) or a `RegExp` constructor.
|
|
19
|
+
- `typeGuards` adds `is*` type guards and `assert*` assertions.
|
|
20
|
+
- `compile` wraps schemas in `z.compile` for faster validation.
|
package/dist/index.cjs
CHANGED
|
@@ -2229,8 +2229,14 @@ const zodGenerator = (0, kubb_kit.defineGenerator)({
|
|
|
2229
2229
|
}
|
|
2230
2230
|
});
|
|
2231
2231
|
//#endregion
|
|
2232
|
+
//#region kubb-extension.json
|
|
2233
|
+
var compatibility = {
|
|
2234
|
+
"kubb": ">=5.8.0",
|
|
2235
|
+
"node": ">=22"
|
|
2236
|
+
};
|
|
2237
|
+
//#endregion
|
|
2232
2238
|
//#region package.json
|
|
2233
|
-
var version = "5.4.
|
|
2239
|
+
var version = "5.4.6";
|
|
2234
2240
|
//#endregion
|
|
2235
2241
|
//#region src/resolvers/resolverZod.ts
|
|
2236
2242
|
/**
|
|
@@ -2322,7 +2328,7 @@ const pluginZod = (0, kubb_kit.definePlugin)({
|
|
|
2322
2328
|
meta: {
|
|
2323
2329
|
name: pluginZodName,
|
|
2324
2330
|
version,
|
|
2325
|
-
compatibility
|
|
2331
|
+
compatibility
|
|
2326
2332
|
},
|
|
2327
2333
|
setup(options) {
|
|
2328
2334
|
const { output = {
|