{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/data/issues/3380","labels_url":"https://api.github.com/repos/emberjs/data/issues/3380/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/data/issues/3380/comments","events_url":"https://api.github.com/repos/emberjs/data/issues/3380/events","html_url":"https://github.com/emberjs/data/issues/3380","id":89321251,"number":3380,"title":"JSON-API correct handling of included entities","user":{"login":"wwwdata","id":818880,"avatar_url":"https://avatars.githubusercontent.com/u/818880?v=3","gravatar_id":"","url":"https://api.github.com/users/wwwdata","html_url":"https://github.com/wwwdata","followers_url":"https://api.github.com/users/wwwdata/followers","following_url":"https://api.github.com/users/wwwdata/following{/other_user}","gists_url":"https://api.github.com/users/wwwdata/gists{/gist_id}","starred_url":"https://api.github.com/users/wwwdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwwdata/subscriptions","organizations_url":"https://api.github.com/users/wwwdata/orgs","repos_url":"https://api.github.com/users/wwwdata/repos","events_url":"https://api.github.com/users/wwwdata/events{/privacy}","received_events_url":"https://api.github.com/users/wwwdata/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/emberjs/data/labels/Needs%20Team%20Discussion","name":"Needs Team Discussion","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-06-18T15:22:02Z","updated_at":"2016-01-09T15:14:32Z","closed_at":"2015-09-17T18:03:14Z","body":"The implementation currently always loads `related` entities from the provided url. If there are ids inside a `data` object in a relation that match the ids of objects inside the `included` object, those already loaded objects must be taken instead of requesting them from the `related` url, because that is not necessary. \r\n\r\nbasic example\r\n\r\n```json\r\n{\r\n    \"data\": [\r\n        {\r\n            \"type\": \"posts\",\r\n            \"id\": \"1\",\r\n            \"attributes\": {\r\n                \"title\": \"JSON API paints my bikeshed!\"\r\n            },\r\n            \"relationships\": {\r\n                \"author\": {\r\n                    \"links\": {\r\n                        \"self\": \"http://example.com/posts/1/relationships/author\",\r\n                        \"related\": \"http://example.com/posts/1/author\"\r\n                    },\r\n                    \"data\": {\r\n                        \"type\": \"people\",\r\n                        \"id\": \"9\"\r\n                    }\r\n                }\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://example.com/posts/1\"\r\n            }\r\n        }\r\n    ],\r\n    \"included\": [\r\n        {\r\n            \"type\": \"people\",\r\n            \"id\": \"9\",\r\n            \"attributes\": {\r\n                \"first-name\": \"Dan\",\r\n                \"last-name\": \"Gebhardt\",\r\n                \"twitter\": \"dgeb\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://example.com/people/9\"\r\n            }\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nhere, the author got already provided in the `included` object and does not need to be fetched. "},"comment":{"url":"https://api.github.com/repos/emberjs/data/issues/comments/170250898","html_url":"https://github.com/emberjs/data/issues/3380#issuecomment-170250898","issue_url":"https://api.github.com/repos/emberjs/data/issues/3380","id":170250898,"user":{"login":"xomaczar","id":2079865,"avatar_url":"https://avatars.githubusercontent.com/u/2079865?v=3","gravatar_id":"","url":"https://api.github.com/users/xomaczar","html_url":"https://github.com/xomaczar","followers_url":"https://api.github.com/users/xomaczar/followers","following_url":"https://api.github.com/users/xomaczar/following{/other_user}","gists_url":"https://api.github.com/users/xomaczar/gists{/gist_id}","starred_url":"https://api.github.com/users/xomaczar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xomaczar/subscriptions","organizations_url":"https://api.github.com/users/xomaczar/orgs","repos_url":"https://api.github.com/users/xomaczar/repos","events_url":"https://api.github.com/users/xomaczar/events{/privacy}","received_events_url":"https://api.github.com/users/xomaczar/received_events","type":"User","site_admin":false},"created_at":"2016-01-09T15:14:32Z","updated_at":"2016-01-09T15:14:32Z","body":"@wecc is this issue legit?"}}