{"action":"closed","issue":{"url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/126","labels_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/126/comments","events_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/126/events","html_url":"https://github.com/django-json-api/django-rest-framework-json-api/issues/126","id":110740582,"number":126,"title":"Included compound documents are being included recursively","user":{"login":"jsenecal","id":1564902,"avatar_url":"https://avatars.githubusercontent.com/u/1564902?v=3","gravatar_id":"","url":"https://api.github.com/users/jsenecal","html_url":"https://github.com/jsenecal","followers_url":"https://api.github.com/users/jsenecal/followers","following_url":"https://api.github.com/users/jsenecal/following{/other_user}","gists_url":"https://api.github.com/users/jsenecal/gists{/gist_id}","starred_url":"https://api.github.com/users/jsenecal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsenecal/subscriptions","organizations_url":"https://api.github.com/users/jsenecal/orgs","repos_url":"https://api.github.com/users/jsenecal/repos","events_url":"https://api.github.com/users/jsenecal/events{/privacy}","received_events_url":"https://api.github.com/users/jsenecal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-09T21:42:09Z","updated_at":"2015-10-16T19:25:42Z","closed_at":"2015-10-16T19:25:42Z","body":"On a model having a relation with itself, including the relation will have the consequence of including the fields in the relation itself.\r\n\r\nhttp://localhost:8000/api/contacts/organizations/534?format=vnd.api%2Bjson&include=resellers,people&fields[organization]=resellers,people&fields[person]=full_name\r\n```json\r\n{\r\n    \"data\": {\r\n        \"type\": \"organization\",\r\n        \"id\": \"534\",\r\n        \"attributes\": {},\r\n        \"relationships\": {\r\n            \"resellers\": {\r\n                \"data\": [\r\n                    {\r\n                        \"type\": \"organization\",\r\n                        \"id\": \"4\"\r\n                    }\r\n                ],\r\n                \"links\": {\r\n                    \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/534/relationships/resellers?format=vnd.api%2Bjson\",\r\n                    \"related\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/534/resellers?format=vnd.api%2Bjson\"\r\n                },\r\n                \"meta\": {\r\n                    \"count\": 1\r\n                }\r\n            },\r\n            \"people\": {\r\n                \"data\": [\r\n                    {\r\n                        \"type\": \"person\",\r\n                        \"id\": \"628\"\r\n                    },\r\n                    {\r\n                        \"type\": \"person\",\r\n                        \"id\": \"1022\"\r\n                    }\r\n                ],\r\n                \"links\": {\r\n                    \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/534/relationships/people?format=vnd.api%2Bjson\",\r\n                    \"related\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/534/people?format=vnd.api%2Bjson\"\r\n                },\r\n                \"meta\": {\r\n                    \"count\": 2\r\n                }\r\n            }\r\n        },\r\n        \"links\": {\r\n            \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/534?format=vnd.api%2Bjson\"\r\n        }\r\n    },\r\n    \"included\": [\r\n        {\r\n            \"type\": \"organization\",\r\n            \"id\": \"4\",\r\n            \"attributes\": {},\r\n            \"relationships\": {\r\n                \"resellers\": {\r\n                    \"data\": [\r\n                        {\r\n                            \"type\": \"organization\",\r\n                            \"id\": \"504\"\r\n                        }\r\n                    ],\r\n                    \"links\": {\r\n                        \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/4/relationships/resellers?format=vnd.api%2Bjson\",\r\n                        \"related\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/4/resellers?format=vnd.api%2Bjson\"\r\n                    },\r\n                    \"meta\": {\r\n                        \"count\": 1\r\n                    }\r\n                },\r\n                \"people\": {\r\n                    \"data\": [\r\n                        {\r\n                            \"type\": \"person\",\r\n                            \"id\": \"111\"\r\n                        },\r\n                        {\r\n                            \"type\": \"person\",\r\n                            \"id\": \"1783\"\r\n                        },\r\n                        {\r\n                            \"type\": \"person\",\r\n                            \"id\": \"1985\"\r\n                        },\r\n                        {\r\n                            \"type\": \"person\",\r\n                            \"id\": \"648\"\r\n                        },\r\n                        {\r\n                            \"type\": \"person\",\r\n                            \"id\": \"421\"\r\n                        },\r\n                        {\r\n                            \"type\": \"person\",\r\n                            \"id\": \"353\"\r\n                        }\r\n                    ],\r\n                    \"links\": {\r\n                        \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/4/relationships/people?format=vnd.api%2Bjson\",\r\n                        \"related\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/4/people?format=vnd.api%2Bjson\"\r\n                    },\r\n                    \"meta\": {\r\n                        \"count\": 6\r\n                    }\r\n                }\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/organizations/4?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"1022\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Neppie Abernathy\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/1022?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"111\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Mrs. Ernestine Bartoletti\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/111?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"1783\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Adrain Franecki\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/1783?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"1985\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Mr. Dandre Haley\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/1985?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"353\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Mrs. Harlene VonRueden\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/353?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"421\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Miss Jasmin Kutch\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/421?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"628\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Dr. Beckham Abernathy\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/628?format=vnd.api%2Bjson\"\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"person\",\r\n            \"id\": \"648\",\r\n            \"attributes\": {\r\n                \"full_name\": \"Creed Kuhn\"\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://api-dev.zerofail.com:8080/api/contacts/people/648?format=vnd.api%2Bjson\"\r\n            }\r\n        }\r\n    ]\r\n}\r\n```"}}