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

Validation Decorator Restrictiveness

Arrange the decorators from least to most restrictive:

Items to put in order

  • @IsString() - the value must be a string
  • @Matches(/^[A-Z]+$/) - the value must match the pattern
  • @IsOptional() - the field does not have to exist at all
  • @IsNotEmpty() - the value must exist and not be empty

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