Class-validator – validate array of objects

Add @Type(() => AuthParam) to your array and it should be working. Type decorator is required for nested objects(arrays). Your code becomes import { IsArray, ValidateNested, ArrayMinSize, ArrayMaxSize } from ‘class-validator’; import { AuthParam } from ‘./authParam.model’; import { Type } from ‘class-transformer’; export class SignInModel { @IsArray() @ValidateNested({ each: true }) @ArrayMinSize(2) @ArrayMaxSize(2) @Type(() … Read more