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

Convention for API Errors #221

Open
Monstarrrr opened this issue Jun 25, 2024 · 0 comments · May be fixed by #222
Open

Convention for API Errors #221

Monstarrrr opened this issue Jun 25, 2024 · 0 comments · May be fixed by #222
Assignees
Labels
[ back-end / blocking This Issue interrupted the progress of an other feature Functionality or significant enhancement for the project

Comments

@Monstarrrr
Copy link
Owner

Monstarrrr commented Jun 25, 2024

Blocking #219 & #220

We preferably need to return errors in one single coherent format :
We should not return error messages in a different structure for api/ (our custom routes) than it is being returned in auth/ (djoser), so we either reproduce the same structure as how djoser handles errors, or we override djoser's)

https://www.django-rest-framework.org/api-guide/exceptions/#custom-exception-handling

The drf-standardized-errors package provides an exception handler that generates the same format for all 4xx and 5xx responses. It is a drop-in replacement for the default exception handler and allows customizing the error response format without rewriting the whole exception handler. The standardized error response format is easier to document and easier to handle by API consumers.

Integration with drf-spectacular
https://drf-standardized-errors.readthedocs.io/en/latest/openapi.html

@Monstarrrr Monstarrrr added [ back-end / feature Functionality or significant enhancement for the project labels Jun 25, 2024
@Monstarrrr Monstarrrr self-assigned this Jun 25, 2024
@Monstarrrr Monstarrrr added the blocking This Issue interrupted the progress of an other label Jun 25, 2024
@Monstarrrr Monstarrrr linked a pull request Jun 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ back-end / blocking This Issue interrupted the progress of an other feature Functionality or significant enhancement for the project
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant