Class-validator: question: option to define dependencies between validators

Created on 5 Nov 2017  路  6Comments  路  Source: typestack/class-validator

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 :)

feature

Most helpful comment

No need to delegate it, it will be implemented in the core.

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings