class-transformer
class-transformer copied to clipboard
Order of decorator execution
I was trying to create a validation for a property, which has to be an array of lowercase strings. To ensure that the strings are lowercased, we wrote a transformer function for transforming all strings to lower case.
The problem is, that the transformer runs before the @IsArray validation. Is it possible to somehow set the order of the execution of the decorators? Changing the order doesn't help.
@IsArray()
@Transform((prop) => prop?.map((el) => el.toString().toLowerCase()))
arrayProp: string[]
Any updates on this question?
I have the same problem (https://github.com/typestack/class-transformer/issues/741)
Anyone can explain this question?
@NoNameProvided
I also have same confusion