Closed angelxmoreno closed 1 week ago
Describe the bug When using classValidatorResolver, combining @IsOptional() with @Length() makes the field required
classValidatorResolver
@IsOptional()
@Length()
To Reproduce codesandbox.io
Expected behavior I expect @IsOptional() to mark the field as not required, though I feel like i am missing a setting of sorts
Hi @angelxmoreno, @IsOptional appears to check if the value === null or value === undefined. However, an input returns an empty string. Consider using @IsEmpty
value === null
value === undefined
@IsEmpty
Describe the bug When using
classValidatorResolver
, combining@IsOptional()
with@Length()
makes the field requiredTo Reproduce codesandbox.io
Expected behavior I expect
@IsOptional()
to mark the field as not required, though I feel like i am missing a setting of sorts