Skip to content

[Feature Request] Add support for netstandard2.0 on FluentValidation.AutoValidation.Mvc #60

Open
@julealgon

Description

@julealgon

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:

  1. Removed support for ValidationStrategy.Annotations and AutoValidateNeverAttribute as 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 targeting netstandard2.0

  2. Removed support for ProblemDetailsFactory and used ValidationProblemDetails directly
    ProblemDetailsFactory was introduced in AspNetCore 3.0 so that one is unavailable. The simplified version for 2.x should work just fine however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions