Julien-R44 / tuyau

RPC / E2E Client For AdonisJS
https://tuyau.julr.dev
MIT License
94 stars 2 forks source link

Validator not correctly evaluated with InferRequestType #22

Closed MuaDDuB closed 1 day ago

MuaDDuB commented 1 day ago

Hello πŸ‘‹

Thx for this awesome lib and the clean work πŸ’ͺ

I encounter an issue with the InferRequestType.

I got this validator : image

It's used in the controller like this: image

The router declares the route like this : image

The generated API looks like this : image

But when I use the InferRequestType, I see that the totalWithTax is declared as string | number πŸ€” image

Do you know what I could have done wrong or if there is an issue in the lib?

Right now, this is a blocker for me πŸ˜…

MuaDDuB commented 1 day ago

We can also see that the id property is also inferred as string | number, which is not the case πŸ€”

Julien-R44 commented 1 day ago

Yeah this is expected. Try sending a string or a number to your controller, and both should work. Here’s the reasoning behind this: https://vinejs.dev/docs/html_forms_and_surprises#number-input-results-in-a-string-value

MuaDDuB commented 1 day ago

Ok thx for the explanation πŸ‘