Class-validator - Validate Array Of Objects
Answer : 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(() => AuthParam) authParameters: AuthParam[]; } Be careful if you are using any exception filter to modify the error reponse. Make sure you understand the structure of the class-validator errors. You can use the following: validator.arrayNotEmpty(array); // Checks if given array is not empty. validator.arrayMinSize(array, min); // Checks if array's length is at least `min` number. (https://github.com/typestack/class-validator#manual-validation) You may want to consider writing custom validator w...