#Zod for validation

1 messages · Page 1 of 1 (latest)

chrome basalt
#

Has any one used Zod over c-v for Nest apps? whats the method you used

bleak grotto
lost grotto
chrome basalt
#

looks promising

chrome basalt
#

since c-v is not maintained nest should focus on something else

bleak grotto
#

They already forked the c-v and c-t repos. But not being maintained does not mean not working. But swithching everything to work with the new javascript decorators will be a lot of fun.

placid geode
#

Here's also a relevant note by Jay: #1074384699587313705 message

lost grotto
chrome basalt
lost grotto
chrome basalt
chrome basalt
lost grotto
chrome basalt
#

hmm this is a serious question

#

i like zod a lot, can do really complex validations out of the box

lost grotto
#

I believe that until we have a "native" support for TS decorators on zod or any other popular validation lib out there, the core will stick with c-v
Although I don't use class-validator (I've made my own validation pipe using Joi), I don't see any reason to introduce yet another lib with the same role as c-v c-t into the core
We could probably replace it in the future tho

chrome basalt
#

whats your approach with joi

lost grotto
#

tbh, the API isn't that good because I'm just using Joi (which doesn't have a decorator API)
I've made a decorator to attach the Joi schema object to some class
And then my pipe will recover that schema to perform the validation (as the docs suggests)

#

I'd try this one: #community-packages message

chrome basalt
#

you get swagger docs also

#

but problem comes when we use graphql 😄

dire mirage
chrome basalt
#

currently cli supports parsing DTOs with ts comments to generate schema

#

but with zod it will be different

lunar rune
#

i dont like zod

dire mirage
#

I love Zod, it's making my life so much easier. You can express much more complex APIs easily

dire mirage
#

Do remember to use strictNullChecks and strict in generall btw

inland crescent
#

@chrome basalt How about typia ever used that?

chrome basalt