I've got a strange bug, when my custom decorators are stopping each other even with stopAtFirstError option set to false. Perharps standard class validator default decorators working as expected.
Minimal code-snippet showcasing the problem
class SomeDto {
@IsStrongPassword({
minNumbers: 1,
minLowercase: 0,
minUppercase: 0,
minSymbols: 0,
}, {
message: 'VALIDATION_PASSWORD_STRENTGH',
})
@MaxLength(20, {
message: 'VALIDATION_PASSWORD_LENGTH_MAX',
})
@MinLength(8, {
message: 'VALIDATION_PASSWORD_LENGTH_MIN',
})
@Requires('currentPassword', { // custom decorator, checks `currentPassword` field is defined
message: 'VALIDATION_CURRENT_PASSWORD_MISSING',
})
@Requires('newPasswordRepeat', { // custom decorator, checks `newPasswordRepeat` field is defined
message: 'VALIDATION_PASSWORD_REPEAT_MISSING',
})
@IsOptional()
newPassword?: string;
}
Description
I've got a strange bug, when my custom decorators are stopping each other even with
stopAtFirstError
option set tofalse
. Perharps standard class validator default decorators working as expected.Minimal code-snippet showcasing the problem
Input, provided for this dto:
Custom decorator definition:
Expected behavior
I'm expecting all custom decorator checks to be done, as below:
Actual behavior
Check for
newPasswordRepeat
field was skipped