Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove regular expression as validation method #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2018
Merged

Remove regular expression as validation method #686

merged 1 commit into from
Oct 31, 2018

Conversation

KyleMit
Copy link
Contributor

@KyleMit KyleMit commented Oct 30, 2018

Using regular expressions for Phone Validation was deprecated as of .Net Framework 4.7.2 and not in any version of .Net Core

Here's the compatability post on removing regex and the default validator in [Phone]:

https://github.com/Microsoft/dotnet/blob/master/Documentation/compatibility/aspnet-472-compat-doc.md

And .NET Core no longer users regular expressions to determine phone number format validity at all (Presumably because of the best practices on Regex and injection/security concerns)

Here's the source code for core without a Regex in sight:

https://github.com/dotnet/corefx/blob/v2.1.5/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/PhoneAttribute.cs

Not sure if the description can be forked by API version / framework, but it looks like this single file is serving as the doc for both .NET Framework and .NET Core, and seems easier to just remove the regular expression bit as it's certainly incorrect in the case of Core, but if there's a way to version the comments, then let me know in the PR and I can update the commit to seperate by version.

@BillWagner
Copy link
Member

ping @chlowell for confirmation. Once you give the OK, I'll merge this.

@BillWagner BillWagner self-requested a review October 31, 2018 15:16
@chlowell
Copy link
Member

@BillWagner I'm only on the compat docs because I wrote automation to generate them, I'm not involved with the content. @rpetrusha, what do you think?

@BillWagner
Copy link
Member

Sorry about that. I meant to ping @divega as owner for System.ComponentModel.DataAnnotations

@rpetrusha rpetrusha requested review from rpetrusha and removed request for rpetrusha October 31, 2018 19:25
@rpetrusha rpetrusha added the ✨ 1st-time dotnet-api-docs contributor! Indicates PRs from new contributors to the dotnet-api-docs repository label Oct 31, 2018
Copy link

@rpetrusha rpetrusha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this to our attention, @KyleMit as well as for contributing to our repo. Since this issue concerns validation by multiple types (EmailAddressAttribute, UrlAttribute, and PhoneAttribute), additional information should be added to the documentation for all three types; I'll open an issue to do address this. Until this issue is addressed, the change you've made is a good one, so I'll merge your PR now. The change should be live on docs.microsoft.com in the next day or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ 1st-time dotnet-api-docs contributor! Indicates PRs from new contributors to the dotnet-api-docs repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants