Mulitple validation of a single property
See original GitHub issueHi,
I’m using FluentValidation in my WebAPI service and after upgrading the packages from 7.0.0-beta2 to 7.0.0, a following problem arised.
Take a look at a simplified scenario:
class A
{ }
class B
{
public A A { get; set; }
}
class AValidator : AbstractValidator<A>
{ }
class BValidator : AbstractValidator<B>
{
BValidator ()
{
this.RuleFor(o => o.A).SetValidator(new AValidator());
}
}
Both validators are registered in the Unity container (instance of A can also be a controller method parameter):
container.RegisterType<IValidator<A>, AValidator>();
container.RegisterType<IValidator<B>, BValidator>();
Validating B results in executing the AValidator twice and giving duplicated validation results.
Any ideas? Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Validate multiple properties with one message
I'm trying to validate a class that has three required properties. If one or more of them is null it should trigger a...
Read more >Introduction to Validate Multiple Data Model Properties ...
This articles describes the various techniques to apply the multiple model state validator inside the GridView using ASP.NET 4.5.
Read more >Add multiple validations to a single property · Issue #3
Add support for multiple validations in the same property since it's supported in the ValidationContext side. ... Basically, if more than one ......
Read more >Validate Property Values - MATLAB & Simulink
When inheriting validation for a property from multiple classes, only a single abstract property in one superclass can define the validation.
Read more >validate multiple property in pegalist | Support Center
Hi, I use pega 7.1.7 and I want to validate multiple property at the same time in pagelist. Which one function of pega...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve pushed 7.0.1 to nuget which contains a new property on the FluentValidationModelValidatorProvider called DisableDiscoveryOfPropertyValidators. If you set this to true then you’ll get the 6.4 behaviour back. Please give it a try.
Great, glad it’s working!