Skip to content
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

zValidator types not working with rpc client query #707

Open
wststone opened this issue Aug 23, 2024 · 2 comments
Open

zValidator types not working with rpc client query #707

wststone opened this issue Aug 23, 2024 · 2 comments

Comments

@wststone
Copy link

image
image
image
As shown in the screenshots above, the rpc client query paramters should have the correct inferred number type.

package version:
"hono": "^4.5.4"
"@hono/zod-validator": "^0.2.2"

@cybercoder-naj
Copy link

Bump! I have the same issue.

@yusukebe
Copy link
Member

Hi @wststone @cybercoder-naj

The Zod Validator uses z.input to infer a query using the request type. With it, the value with z.coerce will have undefined and optional:

CleanShot 2024-09-10 at 16 10 58@2x

This means the value defined z.coerce can be optional or undefined. On the other hand, if you specify the value with z.number(), it can not allow undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants