Question · NestJS course · Module 3: TypeORM and Databases

Entity-level validation

How do you add entity-level validation in TypeORM with class-validator?

Answer options

  • By adding @IsString(), @IsNumber() etc. decorators to entity fields
  • Validation is automatic in TypeORM
  • By writing manual SQL queries with CHECK constraints
  • Validation is not possible at the entity level

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