Closed agowa closed 4 years ago
the issue is something the framework does and not something they could implement/fix.
It would be more correct to say it is something they don't want to fix. You can change the default error representation by overriding the default error handler. Please note that RFC7807 is much younger than DRF and it is unlikely that we change the default error handler. We probably could add another error handler that would implement that RFC though and some 3rd party may already implement it - haven't looked. Meanwhile, as it is possible to override the default handler to implement RFC7807, I'm closing this issue.
Thanks for the clarification.
And for reference, there is a 3rd party library called drf-problems: https://shivanshs9.me/medium/drf-problems-21f7bb4d4675 https://pypi.org/project/drf-problems/
@xordoquy Just so you know, I wanted the exact same thing as you. drf-problems works great, but it doesn't put the invalid parameters into an invalid-params
property like the example given in the RFC7807 specification. I made a fork that does exactly that if you are interested.
Checklist
master
branch of Django REST framework.Steps to reproduce
Invoke the rest api with wrong parameters or attributes.
Expected behavior
RFC7807 compliant error reporting.
E.g. something like:
Actual behavior
Shows error messages that are hard to deal within scripts. And are only human readable.
An example for how the problem looks like in a real live scenario is available over at https://github.com/netbox-community/netbox/issues/5119. They sent me here, as the issue is something the framework does and not something they could implement/fix.
This issue also relates to:
7532
7413
7279