I have a DTO which utilizes class validators as follows.
export class RandomlyNamedDto {
@IsRequired()
@Max(3)
@Min(2)
countryCode: string;
@IsPhoneNumber()
phone: string;
}
I want to pass the country code to @IsPhoneNumber() based on the country code sent by the user. For example if countryCode = 'UK' the validator will be like follows.
IsPhoneNumber('UK')