Question · NestJS course · Module 10: Data Validation

Nested Array Validation

How do you validate an array of nested objects in class-validator?

Answer options

  • @IsArray() is enough to validate objects in an array
  • @ValidateNested({ each: true }) with @Type(() => ClassName)
  • @ValidateArray() with @ArrayType(() => ClassName)
  • You cannot validate arrays of objects in class-validator

You can check the correct answer by solving this task in the CodeWorlds game.