Skip to content

Commit 6eefbf6

Browse files
committed
fix: correct Zod plugin handler selection
Fix switch statement ordering in Zod plugin to properly route compatibilityVersion values to the correct handlers: - case 3: uses handlerV3 - case 4: uses handlerV4 - default: uses handlerV4 Previously case 4 was before case 3, causing all versions to fallthrough to handlerV4. Updated snapshots for both Zod v3 and v4 tests to reflect the corrected plugin behavior.
1 parent 91d91df commit 6eefbf6

File tree

31 files changed

+4420
-4443
lines changed

31 files changed

+4420
-4443
lines changed

packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/default/zod.gen.ts

Lines changed: 231 additions & 233 deletions
Large diffs are not rendered by default.

packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/type-format-zod/zod.gen.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
import * as z from 'zod/v4-mini';
3+
import { z } from 'zod';
44

55
export const zFoo = z.object({
6-
bar: z.optional(z.int()),
7-
foo: z._default(z.coerce.bigint(), BigInt(0)),
6+
bar: z.number().int().optional(),
7+
foo: z.coerce.bigint().default(BigInt(0)),
88
id: z.string()
99
});
1010

1111
export const zBar = z.object({
12-
foo: z.int()
12+
foo: z.number().int()
1313
});
1414

1515
export const zPostFooData = z.object({
16-
body: z.optional(z.never()),
17-
path: z.optional(z.never()),
18-
query: z.optional(z.never())
16+
body: z.never().optional(),
17+
path: z.never().optional(),
18+
query: z.never().optional()
1919
});
2020

2121
/**

0 commit comments

Comments
 (0)