News for hackers. Stuff that matters.
Re:REST vs. GraphQL – A search for evidence on which is better by talaketu on Tuesday December 15, 2020 @10:30PM (#25438719)
REST endpoints typically return data I don't need. For example, the twitter REST API `/1.1/users/show.json?screen_name=twitterdev` it will show me the last tweet for the user. Presumably this involves perhaps waiting for tweet service when the client may not even want the tweet. A GraphQL client can be more explicit about what edges to select.
Re:REST vs. GraphQL – A search for evidence on which is better by fiddlerwoaroof on Tuesday December 15, 2020 @11:17PM (#25439000)
There are specs like jsonapi that solve this problem. I’ve never been entirely convinced that GraphQL is better than actual REST, even if it’s better than most of the APIs people call RESTful
Re:REST vs. GraphQL – A search for evidence on which is better by tshaddox on Wednesday December 16, 2020 @12:41AM (#25439477)
JSON:API provides some of the same functionality as GraphQL, like specifying which fields and nested resources you want, but at that point you’re going to have the same problems with ensuring good performance with any combination of included fields and relationships.
Re:REST vs. GraphQL – A search for evidence on which is better by fiddlerwoaroof on Wednesday December 16, 2020 @01:14AM (#25439638)
I don’t disagree: I tend to find REST + openapi codegen a more compelling developer experience then yet another query DSL.
Re:REST vs. GraphQL – A search for evidence on which is better by collyw on Wednesday December 16, 2020 @06:19AM (#25441316)
> even if it’s better than most of the APIs people call RESTful

I feel your pain.

Re:REST vs. GraphQL – A search for evidence on which is better by dyeje on Wednesday December 16, 2020 @02:09AM (#25439896)
Yes, the advantage of a GraphQL endpoint is you can ask for a variety of things and the tradeoff is potential performance issues for unforeseen queries doing N+1s or something.

If you control the API and know all the use cases for a REST endpoint, the advantage is predictable performance characteristics and the tradeoff is flexibility.

It all depends on what you need (and maybe what tools you're using to mitigate GraphQL resolver problems).