class-validator
class-validator copied to clipboard
question: option to define dependencies between validators
Is there an option to define dependencies between validators? My use case is an custom validator for an email. It shouldn't run if the IsEmail validation failed.
@IsEmail()
@IsUnique()
email: string;
Thank you in advance :)
Hi @twittwer!
No, there is currently no option to do this, all validation rules will be triggered on every property, regardless of the result of the previous ones.
I have implemented it here. Incidentally this project could probably delegate to https://github.com/fireflysemantics/is as I am doing.
No need to delegate it, it will be implemented in the core.
I broke it off into a completely separate module and updated the Typedoc. Obviously you are free to keep it in the core.
https://www.npmjs.com/package/@fireflysemantics/is
@NoNameProvided is the library still in development? I really like the typestack libraries, but they look dead as for now.
I implemented the feature asked for here: https://www.npmjs.com/package/@fireflysemantics/validator
+1 this feature is needed please
+1 this feature is needed please
Set stopAtFirstError: true on ValidationPipe and set validations in reverse manner