-
Notifications
You must be signed in to change notification settings - Fork 18
Description
This is similar to #40 but I believe is a bit different.
I have two models (MaintenanceRecommendation
and Car
). If I do this request (/api/maintenance-recommendations/fix-brakes?include=car
), I will properly send back both the particular recommendation and the related car model.
But in my particular use case, I know the client will have the car
model loaded on the client side by the time this request is made, so there is no reason to request that the full car
relationship be included. The car
model is also quite heavy and takes additional processing that I would like to skip.
What I'd like to do is send back hint data from the backend so that the client can properly wire the recommendation data to the appropriate car without sending the full payload for the car.
Ideally, I would call GET /api/maintenance-recommendations/fix-brakes
and see the following (where the car
relationship data is populated, but there is no included
payload added as well):
{
"data": {
"id": "FancyCar-fix-brakes",
"type": "maintenance-recommendations",
"attributes": {
...
},
"relationships": {
"car": {
"data": {
"id": "FancyCar",
"type": "cars"
}
}
}
}
}
Any thoughts on that? From what I've seen in Twitter conversations with the spec author, this type of response would be valid per the spec ... It's in essence server-side hinting that the backend is allowed to add without it being required ...