-
Notifications
You must be signed in to change notification settings - Fork 18
Description
I'd like to request support for targeting netstandard2.0 in the FluentValidation.AutoValidation.Mvc project so that it can work seamlessly in projects currently relying on AspNetCore libraries targeting older versions of the framework such as NET472.
For context, we have a large solution today with a couple of projects that use various Microsoft.AspNetCore.Mvc.* v2.2.0 and v2.3.0 packages targeting NET472. While we do have the intention of migrating those projects to modern .NET (8 and upwards), we won't be able to perform this upgrade right now.
At the same time, we would like to be able to upgrade our dependencies to modern versions, one of which is our FluentValidation dependency. We are currently using FluentValidation v10 (we created a temporary port of FluentValidation.AspNetCore that targets netstandard2.0 to make that work), but to be able to move to v11 we need support for automatic async validation, which v11 removed.
To completely eliminate our dependency on FluentValidation.AspNetCore, we would like to use FluentValidation.AutoValidation.Mvc instead. However, your library currently doesn't support netstandard2.0, and thus we are stuck.
I cloned the repository and made what I believe would be a "quick" job of supporting netstandard2.0 here for reference:
I made a couple of compromises in there:
-
Removed support for
ValidationStrategy.AnnotationsandAutoValidateNeverAttributeas those were based on the new Endpoints model.
This could probably be changed to something else in the old framework and still be 100% compatible, but I just wanted to see if I could make the project build while targetingnetstandard2.0 -
Removed support for
ProblemDetailsFactoryand usedValidationProblemDetailsdirectly
ProblemDetailsFactorywas introduced in AspNetCore 3.0 so that one is unavailable. The simplified version for2.xshould work just fine however.