Class Validators are not working when the type is a Record <k,v> - NestJS

Viewed 749

We have a DTO property where its type is Record<string, Animal> and Animal is another DTO with class validators like @IsDefined(), @IsNotEmpty(). However these validations are not working as expected and it's probably because it has the Record type.

I already tried adding @ValidatedNested({ each: true }) but still didn't work. How could we make the validation work for the Animal dto in Record<string, Animal>?

1 Answers
Related