Duplicate error messages in DataAnnotations attributes
See original GitHub issueMy WebApiConfig
looks like this:
public static void Register(HttpConfiguration config){
...
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
FluentValidationModelValidatorProvider.Configure(config);
My controller and model look like this:
public class Model
{
[Range(0, 2)]
public int Amount { get; set; }
}
[HttpPost]
public IHttpActionResult Create(Model model)
{
return Ok(model);
}
When the validation is finished, I end up with two Errors
in my ModelState.Values
for the Amount
property. I have no any other custom validators, just FV enabled. Duplicate error messages also appear when using custom validation in a standard way (inheriting from ValidationAttribute
).
Sorry if this issue is duplicated, but I cannot see anything related to it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Duplicate error messages in DataAnnotations attributes
When the validation is finished, I end up with two Errors in my ModelState.Values for the Amount property. I have no any other...
Read more >Double error message with remote data annotation mvc 5
hi i am new to MVC and i am trying to use Remote Data annotation with additional fields to validate Name and last...
Read more >Duplicate Validation Messages with FluentValidation in ASP ...
This means that if you have a model with a property with a type of string, it is expected that the property should...
Read more >How to avoid double data validation in an application with ...
Validation results in dictionary of error messages with property names as keys, sets flag, but if already set does nothing.
Read more >Validation with the Data Annotation Validators (C#)
The page in Figure 6 illustrates the error messages returned when you enter invalid values for the Movie properties.
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 out 8.2.3 with the fix - it should appear in Nuget shortly. Could you give it a try and let me know if it looks ok for you?
Thanks for the help tracking this down.
Thanks - I’ll let you know what I find.