Hacker News new | ask | show | jobs
by dzonga 2561 days ago
You can do the same with JSON:API Sparse field-sets. see documentation here https://jsonapi.org/format/#fetching-sparse-fieldsets. Hence what you've above is not really an advantage of only Graphql.
1 comments

location in the example is a relationship with it's own fields though. We may want to get the top 5 items related to the locations we are fetching for example.

But I think the bigger difference is that we typically expect JSON:API urls to be generated while graphQL queries are more directly edited by the developer. I think that yields an experience that feels more direct.