Custom Error Api Response Model
See original GitHub issueI have a similar use case to https://github.com/JeremySkinner/FluentValidation/issues/548
Except for my use case I want to have a global filter that translates the validation error into a custom model like.
[
{
"errorCode" : 82
"message": "foo was bar"
}
]
I do not need the ValidationResult in my controller action. Is this possible?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Custom Error Message Handling for REST API
In this tutorial, we'll discuss how to implement a global error handler for a Spring REST API. We will use the semantics of...
Read more >Best Practices for REST API Error Handling
Custom Error Message Handling for REST API ... Based on the response code, a client can surmise the result of a particular request....
Read more >Custom error response in Web Api
I would like to create a custom error message to pass errors as json. Something like: if (!ModelState.IsValid) return ModelHasErrors(errors);.
Read more >Custom Error Responses With ASP.NET Core 6 Web API ...
Custom Error Responses With ASP.NET Core 6 Web API and FluentValidation · Create a Web API Project · Implement Endpoints · Validate Requests...
Read more >Create a custom error response via API
Configure custom error responses as rules belonging to the http_custom_errors phase. Use the Rulesets API to create custom error responses ...
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
Apologies, my controller had a filter on it
[ApiController]
attribute on it which took precedence over the global filter. Everything is good 😃 thanks for your helpYes, so long as you also register the validators with the container as per https://fluentvalidation.net/aspnet.html#asp-net-core
Not sure I understand. FluentValidation doesn’t do anything with filters so wouldn’t be impacting this.