Skip to content

Conversation

@xandris
Copy link
Contributor

@xandris xandris commented Oct 16, 2025

OpenAPI permits parameters at the path object level and at the verb level. generateZodRoute only looks for parameters in the latter. Fix it to merge both levels.

Reuse the parameters.yaml file in the hono test cases to catch the issue with tsc. Other code like the hono generator correctly generates imports for these *Params types, expecting the zod generator to emit them. The bug causes compilation to fail with "foo.ts has no exported member named barParams".

Also reduce the number of optional chaining operators by null checking spec up front. generateZodRoute
probably shouldn't proceed if the given path isn't in the API description.

OpenAPI permits parameters at the path object level and at the verb level. `generateZodRoute` only
looks for parameters in the latter. Fix it to merge both levels.

Reuse the parameters.yaml file in the hono test cases to catch the issue with tsc. Other code like
the hono generator correctly generates imports for these *Params types, expecting the zod generator
to emit them. The bug causes compilation to fail with "foo.ts has no exported member named
barParams".

Also reduce the number of optional chaining operators by null checking `spec` up front.
generateZodRoute
probably shouldn't proceed if the given path isn't in the API description.

Signed-off-by: Alexandra Parker <alexandra.i.parker.civ@us.navy.mil>
@melloware melloware added the zod Zod related issue label Oct 16, 2025
@melloware melloware added this to the 7.14.0 milestone Oct 16, 2025
@melloware melloware merged commit 6fd7604 into orval-labs:master Oct 16, 2025
2 checks passed
@xandris xandris deleted the fix/path-level-parameters branch October 16, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zod Zod related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants