@IsOptional cannot work with @MinLength()
Hello, I've tried using this too together but it's not pssoible.
@IsOptional()
@MinLength(3)
comment: string;
So, the ide was to MinLength work only if comment is present. If it's not present the length should not be important. It gives "must be at least 3 chars long error"
Hy @nikdale I tested this and I am sure you are passing empty string into comment property. As described here https://github.com/typestack/class-validator/pull/110 @IsOptional will omit only undefined and null values. Empty string will pass and @MinLength(3) will throw error.
Unfortunately, no. I'm not sending anything. I'm checking that currently on req. Thanks anyway! It can be closed for now.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.