Open Morriz opened 2 years ago
Hello @Morriz and thank you for the suggestion.
It actually seems like a great addition to the library. I'll give it a try soon to see if I could implement it with the current state of the project.
I'll let you know soon :)
Awesome! By the way, maybe the namespace could be @PrismaValGen
to keep it generic, but only if it is possible to express the validators generically of course. It might be a headache to map them to the respective adapters
Any updates here? Did you maybe try to create a PoC for this?
Unfortunately, I hadn't had a chance to, and not sure if I will anytime soon.
So if you feel adventurous, you can work on it. I'll answer any questions you have.
Problem
Hi, Prisma only has simple validation for database fields, but Yup/Joi etc allow have richer validators such as email/regex etc. How much work would it be to put the desired validator+args in decorator comments and apply them in the generator to the ones already picked up?
Suggested solution
Example could be:
To keep it simple I removed
()
from validator without args.Hope to inspire :)