Besides, what do you call the parameter to fill the owner of the children? Fillchildrenowners? It’s nicer to work with if your API takes this into account.
- cause additional sql joins - or pull individual records from a cache (if it’s a small enough dataset) - or cause one additional DB query and save a network round trip.
Example:
/api/v2/discussions?sort=recent&expand=insertUser,updateUser,lastCommentUser,parentCategory
This would be a pretty extensive case but is very useful.
So, commonly, does a REST endpoint that observes HATEOAS (without which it is not REST.)
> I know there are tools like Swagger that solve this problem to some extent, but its not baked into the standard like with GraphQL.
REST is an architectural style, not a standard, but it is baked into the description of the architectural style.
That's what OpenAPI is. (You mention the Swagger tool, but claim it's not baked into “the standard” the way GraphQL is; as well as a tool, Swagger was also the name of the standard, though the current version of that standard is called OpenAPI.)
It is also what JSON:API is.
It is also what OData is.
It is also what RAML is.
Heck, there's a good argument that it is what GraphQL is, too: https://hasura.io/blog/rest-view-of-graphql/
I just pulled up Fielding's paper and couldn't find anything, but wikipedia has a reference to 'Hypermedia as the engine of application state' (HATEOAS).
But then again, I am not sure anyone actually writes systems like this. Very few people actually write REST systems and instead make REST-like APIs.