is it correct to have different types in data array ? didn't found answer in specification, but looks wrong.
{
"data": [
{
"type": "type1",
"id": "id1"
},
{
"type": "type2",
"id": "id2"
}
]
}
is it correct to have different types in data array ? didn't found answer in specification, but looks wrong.
{
"data": [
{
"type": "type1",
"id": "id1"
},
{
"type": "type2",
"id": "id2"
}
]
}
Polymorphic collections are supported by JSON:API specification. Your example is a valid JSON:API document.
This is not mentioned explicitly in the specification. It is only implicitly stated by not requiring all resource objects included as primary data to have the same type.
Please note that it could even include two resource objects with the same
id
as long as they have differenttype
.