-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUGFIX beta] Correctly handle object level errors in json api #3909
Conversation
@bmac any chance of a review? |
Looks good to me. @tchak do you have time to take a look at this pr? |
let title = 'Invalid Attribute'; | ||
let pointer = `/data/attributes/${key}`; | ||
if (key === PRIMARY_ATTRIBUTE_KEY) { | ||
title = 'Invalid Object'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Invalid Document" seems more inline with JSON-API naming.
@adam-knights Thank's a lot for you PR. It is very welcome and needed! |
Thanks @tchak I changed the title to Invalid Document as per your comment. _base would suggest its private when this feels like something people should be happy accessing. Configurable sounds good. I could do that in this PR (or a second one after this is merged, leaving base as default) if you could point me toward something else in a file in the codebase that is configurable so I could follow a similar pattern that would get me going. |
@bmac I am 👍 on this |
[BUGFIX beta] Correctly handle object level errors in json api
Thanks @adam-knights |
Should fix #3602. As per the JSON API spec object level errors should be placed in an object with pointer
/data
.I have chosen to put object level data into errors.base, but this could be anything. If anyone is already using base in the form
pointer: '/data/attributes/base
then the object level ones are combined with this.This is my first ever open source pull request so I fully expect to have missed other things I need to do or improve the code's style.