Description
There's a bug here (unless I'm reading something wrong) and I can't find an open issue that describes this. Please forgive me if this is a duplicate.
Reproduction set-up
Making a compound document using include
. It contains an Organization
, which has_many :people
, and Person
belongs_to :organization
(there are many other cases that would reproduce this, I think). I have an organization with ID 1, and some people belonging to that organization. The document would have an array of people in the included
key.
The bug
The JSON API spec says:
A compound document MUST NOT include more than one resource object for each type and id pair.
The compound document
consists of a document containing both data
and included
top-level keys. The data
is just the Organization
with ID 1, which has relationships
which has people
which has data
, which is an array of Person
objects with just type
(==people
) and id
.
In the included
top-level key, you have the Person
entities related to the organization. But also, the Organization
appears here. So you have two resource objects in the same compound document with the same type (organization
) and ID (1
). That's a bug, right?