I have a resource that contains a lot of has-many “children” resources. I don’t want to include all of the relationships, only one specific (important) relationship (the “parent”).
{
"data": {
"type": "thing",
"id": "1",
"relationships": {
"parent": { "data": { "type": "thing", "id": "9" } },
"children": {
"data": [
{ "type": "thing", "id": "1" },
{ "type": "thing", "id": "2" },
{ "type": "thing", "id": "3" },
{ "type": "thing", "id": "4" },
// ...and so on
]
}
}
}
}
Is it valid to create a relationships object that only contains some of the relationships? I’d like to be able to return something like this:
{
"data": {
"type": "thing",
"id": "1",
"relationships": {
"parent": { "data": { "type": "thing", "id": "9" } }
}
}
}
Is that valid, even though it does not mention all of the known relationship types? Or do I need to change anything in the way that I request this structure (include params, etc)? Or can I return it this way by default?