@kubb/plugin-zod 5.7.0 → 5.7.1
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/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/docs/options.md +9 -9
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -380,9 +380,11 @@ type Options = OutputOptions & {
|
|
|
380
380
|
/**
|
|
381
381
|
* Export a type alias next to every generated schema, so the Zod schema acts as the single source of truth.
|
|
382
382
|
* - `true`: the alias is `z.infer<typeof schema>`.
|
|
383
|
-
* - `'
|
|
383
|
+
* - `'codec'`: request and params schemas use `z.input`, response and error schemas use `z.output`, so a
|
|
384
|
+
* codec types both sides with its domain value. Clients and query hooks then take their types from here.
|
|
385
|
+
* - `'direction'`: deprecated alias of `'codec'`.
|
|
384
386
|
*/
|
|
385
|
-
inferred?: boolean | 'direction';
|
|
387
|
+
inferred?: boolean | 'codec' | 'direction';
|
|
386
388
|
/**
|
|
387
389
|
* Wrap schemas in `z.coerce` so input is coerced before validation. Useful for
|
|
388
390
|
* form data and query params where everything arrives as a string.
|
|
@@ -492,7 +494,7 @@ type ResolvedOptions = {
|
|
|
492
494
|
include: Array<Include> | undefined;
|
|
493
495
|
override: Array<Override<ResolvedOptions>>;
|
|
494
496
|
group: Group | null;
|
|
495
|
-
inferred:
|
|
497
|
+
inferred: boolean | 'codec';
|
|
496
498
|
importPath: NonNullable<Options['importPath']>;
|
|
497
499
|
coercion: NonNullable<Options['coercion']>;
|
|
498
500
|
guidType: NonNullable<Options['guidType']>;
|
package/dist/index.d.ts
CHANGED
|
@@ -380,9 +380,11 @@ type Options = OutputOptions & {
|
|
|
380
380
|
/**
|
|
381
381
|
* Export a type alias next to every generated schema, so the Zod schema acts as the single source of truth.
|
|
382
382
|
* - `true`: the alias is `z.infer<typeof schema>`.
|
|
383
|
-
* - `'
|
|
383
|
+
* - `'codec'`: request and params schemas use `z.input`, response and error schemas use `z.output`, so a
|
|
384
|
+
* codec types both sides with its domain value. Clients and query hooks then take their types from here.
|
|
385
|
+
* - `'direction'`: deprecated alias of `'codec'`.
|
|
384
386
|
*/
|
|
385
|
-
inferred?: boolean | 'direction';
|
|
387
|
+
inferred?: boolean | 'codec' | 'direction';
|
|
386
388
|
/**
|
|
387
389
|
* Wrap schemas in `z.coerce` so input is coerced before validation. Useful for
|
|
388
390
|
* form data and query params where everything arrives as a string.
|
|
@@ -492,7 +494,7 @@ type ResolvedOptions = {
|
|
|
492
494
|
include: Array<Include> | undefined;
|
|
493
495
|
override: Array<Override<ResolvedOptions>>;
|
|
494
496
|
group: Group | null;
|
|
495
|
-
inferred:
|
|
497
|
+
inferred: boolean | 'codec';
|
|
496
498
|
importPath: NonNullable<Options['importPath']>;
|
|
497
499
|
coercion: NonNullable<Options['coercion']>;
|
|
498
500
|
guidType: NonNullable<Options['guidType']>;
|
package/dist/index.js
CHANGED
|
@@ -1681,11 +1681,11 @@ const printerZodMini = ast.createPrinter((options) => {
|
|
|
1681
1681
|
//#endregion
|
|
1682
1682
|
//#region src/generators/zodGenerator.tsx
|
|
1683
1683
|
/**
|
|
1684
|
-
* The helper an inferred alias is printed with. `'
|
|
1684
|
+
* The helper an inferred alias is printed with. `'codec'` reads a request (encode) schema from its
|
|
1685
1685
|
* input and a response (decode) schema from its output; `true` keeps `z.infer` for both.
|
|
1686
1686
|
*/
|
|
1687
1687
|
function aliasKind(inferred, direction) {
|
|
1688
|
-
if (inferred !== "
|
|
1688
|
+
if (inferred !== "codec") return "infer";
|
|
1689
1689
|
return direction === "encode" ? "input" : "output";
|
|
1690
1690
|
}
|
|
1691
1691
|
const zodPrinterCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -2148,7 +2148,7 @@ var compatibility = {
|
|
|
2148
2148
|
};
|
|
2149
2149
|
//#endregion
|
|
2150
2150
|
//#region package.json
|
|
2151
|
-
var version = "5.7.
|
|
2151
|
+
var version = "5.7.1";
|
|
2152
2152
|
//#endregion
|
|
2153
2153
|
//#region src/resolvers/resolverZod.ts
|
|
2154
2154
|
/**
|
|
@@ -2259,7 +2259,7 @@ const pluginZod = defineExtension({
|
|
|
2259
2259
|
group: createGroupConfig(group),
|
|
2260
2260
|
importPath,
|
|
2261
2261
|
coercion,
|
|
2262
|
-
inferred,
|
|
2262
|
+
inferred: inferred === "direction" ? "codec" : inferred,
|
|
2263
2263
|
guidType,
|
|
2264
2264
|
regexType,
|
|
2265
2265
|
oneOfType,
|