Is there a way to set the execution order of decorators when describing a DTO class in NestJS using class-validator
and class-transformer
packages ?
Following code fails when the value of foo
is set to null
with the error:
Expected a string but received a null
@IsOptional()
@IsString()
@IsByteLength(1, 2048)
@Transform(({ value }) => validator.trim(value))
@Transform(({ value }) => validator.stripLow(value))
foo: string;
Even though I have a isString
decorator that should check that indeed a string was passed and must already fail to not pass the execution to the @Transform
decorators, but it didn't fail.