Skip to content
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

Please consider using JSON "Problem Details for HTTP APIs" for returning errors #416

Open
JornWildt opened this issue Mar 30, 2021 · 1 comment
Milestone

Comments

@JornWildt
Copy link

I have noticed that the automatic validation performed by ASP.NET Core utilizes "Problem Details for HTTP APIs" (https://tools.ietf.org/html/rfc7807) which is a Internet standard for reporting errors in JSON. See for instance https://docs.microsoft.com/en-us/aspnet/core/web-api/handle-errors?view=aspnetcore-5.0#validation-failure-error-response.

But Cofoundry has it's own error format when returning errors from ApiResponseHelper.RunCommandAsync - which means JavaScript code has to handle two different error formats. Not a big deal but still annoying.

I know it won't be backwards compatible, so a global setting is probably needed, but it would be nice if Cofoundry returns the same error format as ASP.NET Core does.

@HeyJoel HeyJoel added this to the Backlog milestone Apr 1, 2021
@HeyJoel
Copy link
Member

HeyJoel commented Apr 1, 2021

IApiResponseHelper is deliberately separate to the ASP.NET Core controller configuration so that any changes you make to the ASP.NET defaults don't break the admin panel, and visa versa - we don't want to have to tinker with your ASP.NET defaults and break your application. It's optional for you to use IApiResponseHelper, but it's good to know you're finding it useful and would like it improved.

It was developed a long time ago so it's probably due a refresh, so I'll take a closer look at the problem details spec and see if we can align what we do to it. There's a few other bits that the ASP.NET team have added to web API default recently that are also probably worth looking at too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants