You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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-levelmeta
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 iferrors
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 includeserrors
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.The text was updated successfully, but these errors were encountered: