ember-api-actions icon indicating copy to clipboard operation
ember-api-actions copied to clipboard

Handling cases where jsonapi.version isn't set

Open krainboltgreene opened this issue 5 years ago • 6 comments

#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.

krainboltgreene avatar Apr 30 '19 18:04 krainboltgreene

There were the following issues with this Pull Request

  • Commit: 1069ff114192c28122905036483f15238edd936d
    • ✖ message may not be empty
    • ✖ type may not be empty

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!

ghost avatar Apr 30 '19 18:04 ghost

What is commitlint talking about here?

krainboltgreene avatar Apr 30 '19 18:04 krainboltgreene

There were the following issues with this Pull Request

  • Commit: 1069ff114192c28122905036483f15238edd936d
    • ✖ message may not be empty
    • ✖ type may not be empty
  • Commit: d1c85c9a9c72adf2c78305bffa201a32ed5eecec
    • ✖ message may not be empty
    • ✖ type may not be empty

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!

ghost avatar Apr 30 '19 18:04 ghost

There were the following issues with this Pull Request

  • Commit: 1069ff114192c28122905036483f15238edd936d
    • ✖ message may not be empty
    • ✖ type may not be empty
  • Commit: d1c85c9a9c72adf2c78305bffa201a32ed5eecec
    • ✖ message may not be empty
    • ✖ type may not be empty
  • Commit: e44f9e8c6e193eb3a12a7c0c5d5c4146d0367acc
    • ✖ message may not be empty
    • ✖ type may not be empty

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!

ghost avatar Apr 30 '19 18:04 ghost

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.

    after(response){
      response.jsonapi = { "version": "1.0" };
      serializeAndPush(this, response);
    }

I'm still getting the console message:

serializeAndPush may only be used with a JSON API document. Ignoring response. Document must have a mandatory JSON API object. See https://jsonapi.org/format/#document-jsonapi-object.

jagthedrummer avatar Apr 05 '20 23:04 jagthedrummer

@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:

export default function serializeAndPushRecord(payload) {
  let serializer = this.store.serializerFor(payload.data.type);
  serializer.pushPayload(this.store, payload);
}

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.

dbollinger avatar Apr 06 '20 16:04 dbollinger