Handling cases where jsonapi.version isn't set - #378
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.
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'; |
|
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/versionand 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.