Skip to content
Discussion options

You must be logged in to vote

Hello @angel-luminos ,

the problem is that you have used params schema twice:

  1. in .addMiddleware()
  2. and in .build().

You should not be doing that, because the final endpoint input schema consists of the input schemas of all the middlewares attached, plus the one you specify in .build(). Because you used params schema twice it can not merge those object-schemas due to meeting the same id property twice. This is zod's limitation on intersecting schemas — Unmergable intersection.

So, it should be enough in your case just to delete the input within .build(). The id still will be available for you in all handlers.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2849 on July 28, 2025 18:57.