Description
When generating an error response, DJA takes the contents of the data provided in the response, and makes it all contents of the errors
section. A side effect of this is that you can not have a top-level meta
section, even though this is permitted by the json:api spec.
A good fix might be to have DJA use the response as-is if it contains errors
as a top-level section. Optionally, also check if errors
is a list. Since there are other optional top-level sections, I'm not sure if additional verification (making sure all top-level sections are permitted) is necessary. I think it might reasonable to assume that someone who includes errors
as a top-level section knows what they're doing.
For backwards compatibility, anything which does not appear as valid based on what's decided by the previous paragraph would continue the current behavior of making it the contents of a new top-level errors
section.
Activity
melificent-wolf commentedon Jan 22, 2018
I found a better way to fix this than what I was previously thinking. Use a custom renderer to add "meta" to the top-level of all responses. I can post the code for that here if people want. Not sure if this should be something available in DRF, DJA, both, neither, or somewhere else entirely.
sliverc commentedon Jun 8, 2018
I think this is kind of going into the direction requested in #399 .
Closing this issue.
It would certainly be appreciated if you could add your code how you have done in #399 . We might work out a way in DJA from there.