Skip to content

feat: add decorator to check if two properties match #486

Open
@mrpharderwijk

Description

@mrpharderwijk

First of all, thanks for the awesome validation solution! I use class-validator in my NestJS setup. Now I want to know if and how it is possible to check if two values match with eachother. Let's say I have a dto setup like this:

export class UserCreateDto {
  @IsString()
  @IsNotEmpty()
   firstName: string;

   @IsEmail()
   emailAddress: string;

   @DoesMatch(o => o.emailAddress === o.emailAddressConfirm) // <---- check if email's match
   @IsEmail()
   emailAddressConfirm: string;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions