Description
Which project does this relate to?
Start
Describe the bug
The output of zod parsing removes any extra keys from the data input and means that any subsequent validators cannot successfully validate the body. This can be worked around by putting .passthrough()
at the end of the zod schema. The types for calling the serverFn imply that this is not the case as it has the inputs merged for the data field.
Your Example Website or App
https://codesandbox.io/p/devbox/sleepy-rubin-9qd7w2
Steps to Reproduce the Bug or Issue
Run pnpm dev
Navigate to the home page.
Expected behavior
As a user I would expect that I am able to validate input on the middleware, but then also be able to validate additional inputs on the serverFn, for example if I need to validate that a user can access an organisation, i would put the organisation id in the middleware, validate that they can access it and put the organisation into the context, then validate the serverFn specific inputs in the serverFn. This assumption is backed up by how the types get merged by the middleware and the serverFn.
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Firefox
- Version: 1.114.22
Additional context
No response