Open
Description
this is for only many-to-many relationships, since this kind of relations constitutes an additional table in the database, and sometimes this table can have some additional pivot columns.
According to jsonapi we can't include an "attributes" key in a relationship. However, we can add a "meta" key.
so can we add pivot columns as the following example ?
{
"data": {
"type": "posts",
"attributes": {
"content": "...",
"slug": "hello-world",
"title": "Hello World"
},
"relationships": {
"tags": {
"data": [
{
"type": "tags",
"id": "1",
"meta": {
"pivot": {
"published": true
}
}
}
]
}
}
}
}
for now I am accomplishing this by the above request body example, but with also using the hooks in the controller to override the functionality to get the pivot and adding it to the flow.
in the documentation it is recommended to create a resource for that pivot table, but it just seems to be an overkill for this task, also it will introduce more routes
Metadata
Metadata
Assignees
Labels
No labels