class validator @RequiredIf or @OptionalIf() #2510
Labels
flag: needs discussion
Issues which needs discussion before implementation.
type: feature
Issues related to new features.
I have this class
I want it to be:
In class-validator, there's is the
@ValidateIf()
It's true that
ValidateIf()
will make prop1 optional when prop2 isfalse
. But it will disable my checking for@MaxLength()
and for@IsString()
. Now you can pass a number! that's not what I want. I just want it to be optional.I was thinking, Isn't there a way to say
@IsRequiredIf()
or@IsOptionalIf()
instead of saying@ValidateIf()
?The text was updated successfully, but these errors were encountered: