Dylan Beattie actually talked about resource expansion (with HAL) about 6 years ago: https://youtu.be/g8E1B7rTZBI?t=1654
Essentially, it was a really nice and concise explanation of links to other data, problems with those and adding resource expansion to API endpoints.
That said, it feels like HAL never really took off and the implementation of something like that is very framework specific.
> ...or other approaches to solving this like GraphQL...
GraphQL does seem to solve this, but it's like someone made an equivalent to SQL just for APIs, except that they forgot to include the bit that actually talks to your data store based on the queries and returns data, so you have to write that yourself (e.g. query resolvers).
Unless you're using something like PostGraphile/Prisma/Hasura which exposes your database (provided you use one, which might be the situation in most cases) through GraphQL, but then you run into problems with intermediate data processing or additional access controls, that you might need to be API logic, before your data is returned.
So, instead of the old approach:
[client] <-RESTful request-> [your API] <-SQL query (with parameters)-> [SQL database]
You might be tempted to go with something like this: [client] <-dynamic GraphQL query-> [GraphQL intermediate solution] <-SQL query (with parameters)-> [SQL database]
But since that might prove to be untenable (unsafe), you might need something like: [client] <-dynamic GraphQL query-> [your API] <-dynamic GraphQL query-> [GraphQL intermediate solution] <-SQL query (with parameters)-> [SQL database]
Which kind of feels worse from a complexity standpoint from where we were previously, especially if the queries are dynamic instead of largely static.Back to the topic, BFFs seem like a good idea, especially if they take over some of the gateway functionality as well. I've heard them be described as facade APIs in some cases.