{"action":"closed","issue":{"url":"https://api.github.com/repos/haydn/json-api-store/issues/30","labels_url":"https://api.github.com/repos/haydn/json-api-store/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/haydn/json-api-store/issues/30/comments","events_url":"https://api.github.com/repos/haydn/json-api-store/issues/30/events","html_url":"https://github.com/haydn/json-api-store/issues/30","id":109241081,"number":30,"title":"Missing serialisers for hasOne() and hasMany() fields","user":{"login":"haydn","id":27211,"avatar_url":"https://avatars.githubusercontent.com/u/27211?v=3","gravatar_id":"","url":"https://api.github.com/users/haydn","html_url":"https://github.com/haydn","followers_url":"https://api.github.com/users/haydn/followers","following_url":"https://api.github.com/users/haydn/following{/other_user}","gists_url":"https://api.github.com/users/haydn/gists{/gist_id}","starred_url":"https://api.github.com/users/haydn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haydn/subscriptions","organizations_url":"https://api.github.com/users/haydn/orgs","repos_url":"https://api.github.com/users/haydn/repos","events_url":"https://api.github.com/users/haydn/events{/privacy}","received_events_url":"https://api.github.com/users/haydn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/haydn/json-api-store/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/haydn/json-api-store/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/haydn/json-api-store/milestones/1","html_url":"https://github.com/haydn/json-api-store/milestones/v1.0.0","labels_url":"https://api.github.com/repos/haydn/json-api-store/milestones/1/labels","id":1265821,"number":1,"title":"v1.0.0","description":"","creator":{"login":"haydn","id":27211,"avatar_url":"https://avatars.githubusercontent.com/u/27211?v=3","gravatar_id":"","url":"https://api.github.com/users/haydn","html_url":"https://github.com/haydn","followers_url":"https://api.github.com/users/haydn/followers","following_url":"https://api.github.com/users/haydn/following{/other_user}","gists_url":"https://api.github.com/users/haydn/gists{/gist_id}","starred_url":"https://api.github.com/users/haydn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haydn/subscriptions","organizations_url":"https://api.github.com/users/haydn/orgs","repos_url":"https://api.github.com/users/haydn/repos","events_url":"https://api.github.com/users/haydn/events{/privacy}","received_events_url":"https://api.github.com/users/haydn/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":8,"state":"open","created_at":"2015-08-21T05:48:55Z","updated_at":"2015-10-02T01:47:22Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-10-01T06:54:50Z","updated_at":"2015-10-02T01:47:22Z","closed_at":"2015-10-02T01:47:22Z","body":"hasOne:\n\n```javascript\nserialize: function serialize(resource, data, key) {\n  if (resource[key] === null) {\n    data.relationships[name || key] = null;\n  } else if (resource[key]) {\n    data.relationships[name || key] = {\n      data: {\n        type: resource[key].type,\n        id: resource[key].id\n      }\n    };\n  }\n}\n```\n\nhasMany:\n\n```javascript\nserialize: function serialize(resource, data, key) {\n  if (resource[key]) {\n    data.relationships[name || key] = {\n      data: resource[key].map(x => {\n        return { type: x.type, id: x.id };\n      })\n    };\n  }\n}\n```"}}