Closed severireivinen closed 1 month ago
Thank you for the report! I will try to reproduce
@severireivinen I cannot reproduce the error, see https://github.com/turkerdev/fastify-type-provider-zod/pull/114
Could you please send a PR with a modification of the test from https://github.com/turkerdev/fastify-type-provider-zod/pull/114, adjusted to be closer to your use-case, illustrating how it is failing? I suspect that the error might be on your side rather than within the library (not reacting correctly to some of the behaviour changes in the major release)
@severireivinen Having investigated further, I believe that the error that you are receiving is most likely due to your error handler expecting ZodError
to be thrown, and the latest version of the library throwing FastifyError
with validation
field instead.
Together with @Bram-dc we have released 4.0.0 which exposes type guards for working with the new types conveniently, you may want to upgrade to that. See "Customizing error responses" section of the updated readme.
@severireivinen You can see here an example of update needed when transitioning to a newer version of fastify-type-provider-zod
: https://github.com/lokalise/node-service-template/pull/842
Thank you for the investigations @kibertoad ! I haven't had time to come back to this yet but will do this week
This solved the issue @kibertoad 🎉 Thank you for the help! I will close this.
glad to hear that, thank you for the update! please don't hesitate to reach out if anything else comes up
Been updating our dependencies and noticed that latest version of this package doesn't return proper error when validation fails.
Example route (this is wrapped in TypeProvider):
Currently using v2.1.0 Passing invalid body to endpoint correctly returns status 400
Updating to 3.0.0 Passing invalid body to endpoint now returns 500