Click in order · NestJS course · Module 10: Data Validation

Creating a Custom Validation Decorator

Arrange the steps for creating a custom validation decorator:

Items to click

  • Create a decorator function with registerDecorator()
  • Create a class with @ValidatorConstraint
  • Implement validate() and defaultMessage()
  • Use @IsMyValidator() in a DTO

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