{"action":"created","issue":{"url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/issues/47","labels_url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/issues/47/comments","events_url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/issues/47/events","html_url":"https://github.com/digitalsadhu/loopback-component-jsonapi/issues/47","id":116778946,"number":47,"title":"null relationship data","user":{"login":"BenjaminHorn","id":5570232,"avatar_url":"https://avatars.githubusercontent.com/u/5570232?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjaminHorn","html_url":"https://github.com/BenjaminHorn","followers_url":"https://api.github.com/users/BenjaminHorn/followers","following_url":"https://api.github.com/users/BenjaminHorn/following{/other_user}","gists_url":"https://api.github.com/users/BenjaminHorn/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjaminHorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjaminHorn/subscriptions","organizations_url":"https://api.github.com/users/BenjaminHorn/orgs","repos_url":"https://api.github.com/users/BenjaminHorn/repos","events_url":"https://api.github.com/users/BenjaminHorn/events{/privacy}","received_events_url":"https://api.github.com/users/BenjaminHorn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"listepo","id":2510800,"avatar_url":"https://avatars.githubusercontent.com/u/2510800?v=3","gravatar_id":"","url":"https://api.github.com/users/listepo","html_url":"https://github.com/listepo","followers_url":"https://api.github.com/users/listepo/followers","following_url":"https://api.github.com/users/listepo/following{/other_user}","gists_url":"https://api.github.com/users/listepo/gists{/gist_id}","starred_url":"https://api.github.com/users/listepo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/listepo/subscriptions","organizations_url":"https://api.github.com/users/listepo/orgs","repos_url":"https://api.github.com/users/listepo/repos","events_url":"https://api.github.com/users/listepo/events{/privacy}","received_events_url":"https://api.github.com/users/listepo/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-11-13T14:32:55Z","updated_at":"2015-11-13T18:45:44Z","closed_at":null,"body":"### in my database\r\n\r\n**service** table\r\n\r\nid | name| service-group-id\r\n------------ | -------------|----------\r\n1 | service1|1\r\n**service-group** table\r\n\r\nid | name| \r\n------------ | -------------\r\n1 | service-group1\r\n\r\n\r\n### Loopback\r\n**service.json**\r\n\r\n```javascript\r\n{\r\n  \"name\": \"service\",\r\n...\r\n  \"include\": [\"service-group\"],\r\n  \"properties\": {\r\n    \"name\": {\r\n      \"type\": \"string\",\r\n      \"required\": true\r\n    },\r\n    \"service-group-id\": {\r\n      \"type\": \"number\"\r\n    }\r\n  },\r\n  \"relations\": {\r\n    \"service-group\": {\r\n      \"type\": \"belongsTo\",\r\n      \"model\": \"service-group\",\r\n      \"foreignKey\": \"service-group-id\"\r\n    }\r\n  },\r\n...\r\n}\r\n```\r\n### localhost:3000/explorer\r\n**http://localhost:3000/api/services**\r\n```javascript\r\n{\r\n  \"data\": [\r\n    {\r\n      \"type\": \"services\",\r\n      \"relationships\": {\r\n        \"service-group\": {\r\n          \"data\": null\r\n        }\r\n      },\r\n      \"id\": \"1\",\r\n      \"attributes\": {\r\n        \"name\": \"service1\"\r\n      },\r\n      \"links\": {\r\n        \"self\": \"http://localhost:3000/api/services/1\"\r\n      }\r\n    }\r\n  ]\r\n}\r\n\r\n```\r\n\r\n**http://localhost:3000/api/services/1/service-group**\r\n\r\n```javascript\r\n{\r\n  \"data\": {\r\n    \"type\": \"service-groups\",\r\n    \"id\": \"1\",\r\n    \"attributes\": {\r\n      \"name\": \"service-group1\"\r\n    },\r\n    \"links\": {\r\n      \"self\": \"http://localhost:3000/api/service-groups/1\"\r\n    }\r\n  },\r\n  \"links\": {\r\n    \"self\": \"http://localhost:3000/api/services/1/service-group\"\r\n  }\r\n}\r\n```\r\n\r\nWhy is service-group.data: null? Should not included some data like this suggests: http://emberjs.com/api/data/classes/DS.JSONAPISerializer.html?\r\n"},"comment":{"url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/issues/comments/156517742","html_url":"https://github.com/digitalsadhu/loopback-component-jsonapi/issues/47#issuecomment-156517742","issue_url":"https://api.github.com/repos/digitalsadhu/loopback-component-jsonapi/issues/47","id":156517742,"user":{"login":"digitalsadhu","id":1177098,"avatar_url":"https://avatars.githubusercontent.com/u/1177098?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalsadhu","html_url":"https://github.com/digitalsadhu","followers_url":"https://api.github.com/users/digitalsadhu/followers","following_url":"https://api.github.com/users/digitalsadhu/following{/other_user}","gists_url":"https://api.github.com/users/digitalsadhu/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalsadhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalsadhu/subscriptions","organizations_url":"https://api.github.com/users/digitalsadhu/orgs","repos_url":"https://api.github.com/users/digitalsadhu/repos","events_url":"https://api.github.com/users/digitalsadhu/events{/privacy}","received_events_url":"https://api.github.com/users/digitalsadhu/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T18:45:44Z","updated_at":"2015-11-13T18:45:44Z","body":"Just to follow up a bit. This is what I would expect to see:\r\n\r\n## Without includes filter:\r\n\r\nJust the links to the related data should be included. Something like the following:\r\n\r\nGET http://localhost:3000/api/services\r\n\r\n```js\r\n{  \r\n   \"data\":[  \r\n      {  \r\n         \"type\":\"services\",\r\n         \"relationships\":{  \r\n            \"category\":{  \r\n               \"links\": {\r\n                 \"self\": \"http://localhost:3000/api/services/1/relationships/category\",\r\n                 \"related\": \"http://localhost:3000/api/services/1/category\"\r\n               }\r\n            }\r\n         },\r\n         \"id\":\"1\",\r\n         \"attributes\":{  \r\n            \"name\":\"service1\"\r\n         },\r\n         \"links\":{  \r\n            \"self\":\"http://localhost:3000/api/services/1\"\r\n         }\r\n      }\r\n   ],\r\n   \"links\":{  \r\n      \"self\":\"http://localhost:3000/api/services\"\r\n   }\r\n}\r\n```\r\nExample here: http://api.pixelhandler.com/api/v1/posts\r\n\r\n## With the include filter\r\n\r\nI would expect to see the relationship data and also a root level `included` key. Something like the following:\r\n\r\nGET http://localhost:3000/api/services?filter={\"include\":\"service-group\"}\r\nor\r\nGET http://localhost:3000/api/services?filter[include]=service-group\r\n\r\n```js\r\n{  \r\n   \"data\":[  \r\n      {  \r\n         \"type\":\"services\",\r\n         \"relationships\":{  \r\n            \"category\":{  \r\n               \"links\": {\r\n                 \"self\": \"http://localhost:3000/api/services/1/relationships/category\",\r\n                 \"related\": \"http://localhost:3000/api/services/1/category\"\r\n               },\r\n               \"data\": {\"type\": \"category\", \"id\": 1}\r\n            }\r\n         },\r\n         \"id\":\"1\",\r\n         \"attributes\":{  \r\n            \"name\":\"service1\"\r\n         },\r\n         \"links\":{  \r\n            \"self\":\"http://localhost:3000/api/services/1\"\r\n         }\r\n      }\r\n   ],\r\n   \"links\":{  \r\n      \"self\":\"http://localhost:3000/api/services?filter[include]=service-group\"\r\n   },\r\n   \"included\": [\r\n     {\r\n       \"type\": \"category\", \r\n       \"id\": 1,\r\n       \"links\": {\r\n         \"self\": \"...\"\r\n       },\r\n       \"attributes\": {\r\n         ...\r\n       }\r\n     }\r\n   ]\r\n}\r\n```\r\n\r\nSee here for an example:\r\nhttp://api.pixelhandler.com/api/v1/comments?include=post"}}