Is it possible to control which fields of a relation are displayed?
If I have a Part
collection, and it has a relation field parts
, which is a “has many” relation to Part
itself, can I display a single field such as the id?
The goal would be:
[
{
"id": 1,
"name": "Foo",
"parts": [],
...
},
{
"id": 2,
"name": "Bar",
"parts": [1],
...
}
]
The goal here is to avoid unnecessary duplication of data, as I don’t need all of the relation data if I know its id and it also appears in the request.
I believe this might be possible by creating a custom view, but I’m curious if this is supported elsewhere.