-
Notifications
You must be signed in to change notification settings - Fork 844
Labels
flag: needs discussionIssues which needs discussion before implementation.Issues which needs discussion before implementation.type: featureIssues related to new features.Issues related to new features.
Description
Description
I'm currently using the validation decorators in my NestJS DTOs. However, I'm encountering limitations with the IsMobilePhone decorator, as it only accepts a single locale. This issue persists with "class-validator": "^0.14.1".
For example:
@IsMobilePhone(
'en-IN',
{ strictMode: true },
{
message: 'Phone number must be a valid Indian phone number',
}
)
phoneNumber: stringProposed Solution
The IsMobilePhone decorator should be enhanced to accept multiple locales. This would allow for validation against phone numbers from multiple regions. For instance:
@IsMobilePhone(
['en-IN', 'en-US', 'de-DE'],
{ strictMode: true },
{
message: 'Phone number must be a valid phone number',
}
)
phoneNumber: stringThis enhancement would significantly improve the flexibility and usability of the IsMobilePhone decorator.
kurbar, townegr, michael-bergeron-hh, pdh372 and m-narminov
Metadata
Metadata
Assignees
Labels
flag: needs discussionIssues which needs discussion before implementation.Issues which needs discussion before implementation.type: featureIssues related to new features.Issues related to new features.