#Zod Validator

1 messages · Page 1 of 1 (latest)

rocky anchor
#

Hi everyone,
I have been using this framework for quite a while and I am very pleased. Currently our team is working to move to a mono repo architecture and because we are using Zod as our validation library we also want to use it in the backend.
We have a working POC but I would like to know if there is anything I should be concerned about.
NestJS TypeScript

barren rune
#

Only thing to note is that zod is a schema based validator and thus doesn't have a class type to attach to route handler parameters so it can't be automatically deduced for the pipe what type to validate against.

rocky anchor
#

So now if I use it I will have to manually add the schema to the router?

barren rune
#

You can make a zod pipe that takes in the schema, but you'll end up having to add that pipe to every route handler parameters decorator

rocky anchor
#

Okay, thank you very much !!