Question · NestJS course · Module 10: Data Validation

Using a Custom Validator

How do you apply a custom validator created with @ValidatorConstraint to a DTO field?

Answer options

  • By calling new ConstraintName().validate()
  • By importing in app.module.ts
  • Using the @Validate(ConstraintName) decorator
  • Using validation middleware

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