aspnet / Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider making RequiredAttributeAdapter public

pranavkm opened this issue · comments

FluentValidation uses the type: https://github.com/JeremySkinner/FluentValidation/blob/master/src/FluentValidation.AspNetCore/FluentValidationClientModelValidatorProvider.cs#L113. An alternative might be to consider changing FluentValidation to use IValidationAttributeAdapterProvider

I need some way to explicitly identify required rules (for the purpose of being able to remove implicitly-added required validators that double up with what FluentValidation is doing) which is why I'm using RequiredAttributeAdapter here.

If this becomes internal, would I be able to use IValidationAttributeAdapterProvider to achieve the same thing? If needbe I can still check the type by looking for AttributeAdapterBase<RequiredAttribute> (or even reflection), although it would be nice not to have to make changes like this unless really needed. What's the reason for wanting to make this internal?

What's the reason for wanting to make this internal?

We made all of our pubternal types internal in 3.0. See https://github.com/aspnet/Mvc/issues/8689. I tried building your repo and there's a few usings that need to be cleaned up, but outside of RequiredAttributeAdapter everything just worked. Making the type public sounds like the least problematic thing to do here.