{"action":"created","issue":{"url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/issues/14","labels_url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/issues/14/comments","events_url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/issues/14/events","html_url":"https://github.com/marshmallow-code/marshmallow-jsonapi/pull/14","id":116273687,"number":14,"title":"WIP: Enable to serialize null relations closes #10","user":{"login":"jo-tham","id":7353689,"avatar_url":"https://avatars.githubusercontent.com/u/7353689?v=3","gravatar_id":"","url":"https://api.github.com/users/jo-tham","html_url":"https://github.com/jo-tham","followers_url":"https://api.github.com/users/jo-tham/followers","following_url":"https://api.github.com/users/jo-tham/following{/other_user}","gists_url":"https://api.github.com/users/jo-tham/gists{/gist_id}","starred_url":"https://api.github.com/users/jo-tham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jo-tham/subscriptions","organizations_url":"https://api.github.com/users/jo-tham/orgs","repos_url":"https://api.github.com/users/jo-tham/repos","events_url":"https://api.github.com/users/jo-tham/events{/privacy}","received_events_url":"https://api.github.com/users/jo-tham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-11T06:18:34Z","updated_at":"2015-11-13T06:08:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/pulls/14","html_url":"https://github.com/marshmallow-code/marshmallow-jsonapi/pull/14","diff_url":"https://github.com/marshmallow-code/marshmallow-jsonapi/pull/14.diff","patch_url":"https://github.com/marshmallow-code/marshmallow-jsonapi/pull/14.patch"},"body":"Hi @sloria \r\n\r\nthis is neither of the PR's I've promised you lately... but this one was more urgent for me :wink: \r\n\r\nI testing this out in a flask application, and the null relationship fields in the json are simply missing. So while it seems this patch is OK, the desired result for a schema dump is not complete.\r\n\r\nI think we need to add a test to `test_schema.py` for serializing relatonships, including null relationship and then deal with why the objects are not being serialized properly with null relationship. \r\n\r\nI looked around, seems like marshmallow-jsonapi.schema.format_item() does some magic with dict.update, which I think may be the cause. I suspect using {} instead of the jsonapi standards for empty relationships might be work with the given format_item, looks like it might give an empty collection for the relationship.\r\n\r\nAny suggestions? \r\n"},"comment":{"url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/issues/comments/156334305","html_url":"https://github.com/marshmallow-code/marshmallow-jsonapi/pull/14#issuecomment-156334305","issue_url":"https://api.github.com/repos/marshmallow-code/marshmallow-jsonapi/issues/14","id":156334305,"user":{"login":"jo-tham","id":7353689,"avatar_url":"https://avatars.githubusercontent.com/u/7353689?v=3","gravatar_id":"","url":"https://api.github.com/users/jo-tham","html_url":"https://github.com/jo-tham","followers_url":"https://api.github.com/users/jo-tham/followers","following_url":"https://api.github.com/users/jo-tham/following{/other_user}","gists_url":"https://api.github.com/users/jo-tham/gists{/gist_id}","starred_url":"https://api.github.com/users/jo-tham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jo-tham/subscriptions","organizations_url":"https://api.github.com/users/jo-tham/orgs","repos_url":"https://api.github.com/users/jo-tham/repos","events_url":"https://api.github.com/users/jo-tham/events{/privacy}","received_events_url":"https://api.github.com/users/jo-tham/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T06:08:03Z","updated_at":"2015-11-13T06:08:03Z","body":"Verbatim\r\n\r\nhttp://jsonapi.org/format/1.0/#document-resource-object-linkage\r\n\r\n```\r\nResource Linkage\r\n\r\nResource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any URLs via links.\r\n\r\nResource linkage MUST be represented as one of the following:\r\n\r\n    null for empty to-one relationships.\r\n    an empty array ([]) for empty to-many relationships.\r\n    ...\r\n```\r\n\r\nso a \"**compound**\" (see also #11) document should represent resource *linkages* in the format that this pull request achieves (pending your verification!). \r\n\r\nIt is not clear to me how these linkages should be represented in *non*-compound documents. My interpretation is that the above rules for null/empty resource linkages in *non*-compound documents, too. But I can verify with the jsonapi crew. .. "}}