Question · NestJS course · Module 10: Data Validation

@Type Requirement with @ValidateNested

Why does @ValidateNested() require @Type() from class-transformer?

Answer options

  • @Type() generates automatic Swagger documentation
  • Without @Type(), NestJS does not know which class to convert the raw object to
  • @Type() improves validation performance
  • @Type() is optional and has no effect on validation

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