Skip to content

Correctly stringify arguments that are objects

Compare
Choose a tag to compare
@michaelrabie michaelrabie released this 02 Feb 19:24
· 12 commits to master since this release

E.g. Given a model:

import DS from 'ember-data';

export default DS.Model.extend({
  comment: DS.belongsTo('comment', { async: false })
});

When calling .save() on an instance of this model, the query would be serialized like this by ember-graphql-adapter:
mutation post_update (id: "1", comment: "object Object") { id comments { id body } }

To allow the usage of async: false and to allow your GraphQL schema to accept objects as arguments, the adapter will now serialize the above example like so:
mutation post_update(id: "1", comment: { id: "2", body: "bar" }) { id comments { id body } }