-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting IStatusGeneric to ProblemDetails #5
Comments
Hi @kcaswick, There are two issues here:
Taking the "is it worth adding support for the ProblemDetails class" issue I would say no, as:
The "EfCore.GenericServices.AspNetCore uses a out of date version of Microsoft.AspNetCore.Mvc.Core" issue is a good point and at some time I will update it, BUT due to the NuGet definition the latest version of AspNetCore.Mvc.Core used by your app replaces the 2.1 version. And beacause this library uses only the very basic parts of AspNetCore, like I'm quite busy at the moment so I won't updating this library to the latest AspNetCore version - maybe when I update any of my libraries to .NET 6. I will leave this issue open to remind me. |
Landed here wanting to return public class BaseController : ControllerBase
{
public ActionResult<WebApiMessageOnly> WebApiResponse(IStatusGeneric status)
{
if (status.IsValid)
{
return status.Response();
}
status.CopyErrorsToModelState(ModelState);
return ValidationProblem(ModelState);
}
} |
Thanks @ConnorJBishop for that. I plan to update the libraries to 3.1 and I might add a |
I believe my bigger concern had been a 3rd issue, that WebApiMessageAndResult was consistent with the old error response, but not ProblemDetails, so the consistency in format between success and failure responses was lost. If I remember right, Hellang.Middleware.ProblemDetails took care of converting a BadRequestObjectResult to ProblemDetails. However since then OData became a requirement for my project, and it has its own special error format to return anyway. I'd be fine with closing this issue, unless you want to leave it open for others. |
Is there any work in progress to support converting IStatusGeneric to ProblemDetails? Or an alternate package that does? It doesn't really make sense to use the ASP.NET 2.1 format for new APIs.
The text was updated successfully, but these errors were encountered: