The main issue with this way in my opinion - inconsistent resource structure. By the way this isn’t problem, it’s just possibility of the problem in the future. I cannot be 100% sure that it’s right or wrong, just leaving it here as a notice that more research required.
GET /trucks?include=trailer
output:
{
"data": [{
"type": "truck",
"id": "vehicle-1",
"relationships": {
"trailer": {
"data": {
"type": "trailer",
"id": "vehicle-1-trailer"
}
}
}
}]
}
GET /parkings?include=vehicles,vehicles.features
{
"data": [{
"type": "truck",
"id": "vehicle-1",
"relationships": {
"features": {
"data": {
"type": "trailer",
"id": "vehicle-1-trailer"
}
}
}
}]
}