TRPC generated create
mutation fails in basic polymorphic use case with zod error invalid_union
#1993
Labels
create
mutation fails in basic polymorphic use case with zod error invalid_union
#1993
Description and expected behavior
I'm using Zenstack with the TRPC generator & react-query plugin in a NextJS app.
Given the following zmodel:
When calling the autogenerated
UserFolder.create
TRPC mutation as such:The request then fails with a Zod validation error:
Environment (please complete the following information):
Additional context
I can work around this issue by creating my own TRPC mutation, which uses the simpler
UserFolderCreateSchema
as the input schema.I have created an example repo with the issue here:
https://github.com/diesal11/zenstack-trpc-zod-bug
The text was updated successfully, but these errors were encountered: