Omar
04/17/2022, 3:34 PMHyo
04/18/2022, 5:42 AMOmar
04/18/2022, 3:55 PMChris Tsongas
04/19/2022, 2:34 PMOmar
04/19/2022, 2:53 PMaddMethod,
for example, I had to write a oneOfSchemas
method to replicate the Joi alternatives functionality. So for me, I would use Yup on the frontend only, since it already plays well with other frontend libraries like formik. And I would stick to Joi on the backend.
You have a second option for the backend by the way, which is class validator, and it's really cool.Chris Tsongas
04/20/2022, 5:04 AMOmar
04/20/2022, 10:16 AMOmar
05/04/2022, 6:19 PMChris Tsongas
05/05/2022, 1:47 AMOmar
05/05/2022, 4:11 PMzod-prisma
generates just the base models as they are described in the prisma model; not really full CRUD schemas for all actions a schema can provide. So there might be still a need for me to build that generator, similar to yup and joi.Omar
05/05/2022, 4:12 PMChris Tsongas
05/05/2022, 4:15 PMOmar
05/05/2022, 4:24 PMOmar
05/05/2022, 4:25 PMOmar
05/06/2022, 4:08 PMChris Tsongas
05/06/2022, 5:00 PMOmar
05/07/2022, 1:51 AMChris Tsongas
05/07/2022, 2:53 AMOmar
05/07/2022, 4:24 PM@Validate(CreatePostSchema)
Inside the Validate decorator, you simply run schema.validate() or similar, like schema.parse in case of zod.
This way, you remove validation logic from inside of resolvers, which makes them cleaner and more readable.Omar
05/07/2022, 4:26 PMOmar
05/08/2022, 1:27 AM