-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defining procedures with no input
#5
Comments
Hi @dodas. Yes you're right - the current workaround for no input: z.object({}), Here's the reason for why Zod validators are required for both
We could allow |
I currently have queries/mutations with no [{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [],
"message": "Required"
}] Couldn't we fallback no |
This is not possible. I think this would be best solved by allowing this: input: z.void(), Now your tRPC API would continue working as intended and Thoughts? |
Curious about this; care to explain why it wouldn't be possible, please? Using |
Zod validator (expects
|
Procedures are constructed in |
I will recommend using |
Ah I see, thanks. Seems like this is a limitation of trpc and could be potentially solved if trpc used a constant fallback parser and exported it, instead of creating an anonymous fn, so we could compare references. Anyway, I am totally fine with using |
We are actively working on |
Hi @dodas. Please upgrade to the newest release Head's up that this release includes a breaking change - please see #11. |
Defining a query/mutation with no
input
results inIt's possible to workaround this by defining an empty input:
However, that way an empty object is expected when calling the query via TRPC client.
It's a legit use-case to have queries/mutations with no
input
, right? Can we allow omittinginput
in such cases?The text was updated successfully, but these errors were encountered: