-
Notifications
You must be signed in to change notification settings - Fork 50
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
Handling cases where jsonapi.version isn't set #378
base: master
Are you sure you want to change the base?
Conversation
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
} | ||
function isDocWithData(doc: any): doc is DocWithData { | ||
return isJsonApi(doc) && ['object', 'array'].indexOf(typeOf((doc as DocWithData).data)) >= 0; | ||
function isValidResponse(doc: any): doc is DocWithData { |
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.
Maybe I don't understand typescript, but why isn't the return type boolean
?
What is |
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
console.debug("Received a repsonse that doesn't have a /jsonapi/version property") | ||
|
||
// Don't even bother if the data propery doesn't exist | ||
return typeof response.data !== 'undefined'; |
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.
Shouldn't this be doc.data
?
Anything we can do to get this merged? I just ran into this and am trying to work around it like so, but with no luck.
I'm still getting the console message:
|
@jagthedrummer I was running into friction here as well (literally yesterday) -- in the short term, so that I could start using this add-on, I just created my own (very brittle) method:
YMMV, and I only need this for single members (not collections) right now, but if you're looking for a quick answer while this addon goes through some modernization and maintenance, something like this could be an option. |
#291 is a problem for anyone using the ruby library jsonapi-resources, as it both doesn't support returning
/jsonapi/version
and it is very annoying to hack in.I prefer to trust but warn, but failing that I've at least checked for a data attribute.