Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

Allow adding failures programmatically #243

@ramduq

Description

@ramduq

FluentValidationValidator does not allow adding failures to the failure collection. This is needed in the following scenario:

Scenario
Client is a Blazor web assembly app. Server is an API project. Both perform validations using fluent validation. Thus, an API request from the client might get a response containing a List<ValidationFailure>. If it were possible to add these (backend) failures to the current collection, the UI would be updated accordingly (e.g. coloring the related fields in red).

Proposed solution

A new method

AddFailures(Dictionary<FieldIdentifier, List<ValidationFailure> failures)

** Alternatives considered**
I considered extending the class FluentValidationValidator in my project. However LastValidationResult (the dictionary of failures) is an internal field, which prevents accessing it from external projects.

An alternative solution would be to make this field protected, making it possible to manipulate this collection in derived classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestRequest to add a new featureTriageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions