-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Description
In my response, I want to include relationship information in the main resource, but I don't want to include the whole resource in the "included" section, mostly because the other resource has no attributes, so it's redundant.
I.e., I want to generate a response that looks like the following:
{
"data": {
"id": "5",
"type": "things",
"attributes": {
"name": "A Thing",
},
"links": {
"self": "/things/5"
},
"relationships": {
"otherThing": {
"data": {
"type": "otherThings",
"id": "123"
}
}
}
}
}When I serialize without any :include, then I get:
"relationships": {
"otherThing": {
}
}When I serialize with include: 'otherThing', then I get:
"relationships": {
"otherThing": {
"type": "otherThings", <--- I want this information
"id": "123" <--- and also this
}
}
"included": [ <--- But I don't need any of this
{
"type": "otherThings",
"id": "123",
"attributes": {},
"links": {
"self": "/otherThings/123"
}
}
]Is there a way to get this middleground?
Metadata
Metadata
Assignees
Labels
No labels