logoalt Hacker News

DanielHB • today at 10:16 AM • 1 reply • view on HN

The objectively main advantage of GraphQL for most orgs is forcing the API to be statically typed in a single uniform language (graphql schema). Forget everything else, I can't believe all these backend people who sneer at dynamic languages (JS/Python/Ruby) and then provide non-typed APIs, often just serializing objects that they themselves are not typing in their own code.

I worked in an org that introduced a GraphQL gateway that was mandated to be the only point of contact to the backend. That was literally the only way to get backend developers to provide god damn types consistently.

Sure the same can be achieved with OpenAPI, but the GraphQL gateway _forces_ it, you can't work around it, you can't be "we are too busy now, we will do it later" or "it is just a POC (that ends up in prod)". It doesn't help that OpenAPI is terrible to use in some runtimes (like Go) and most people who actually do use OpenAPI don't validate _every_ request/response against the spec before processing it.

GraphQL in this regard got it right, you either conform to the spec you created or you GTFO.

Another big thing is consistency in implementing "long-running queries" (GraphQL subscriptions) since there is no standard for this kind of stuff in the non-GraphQL-world it ends up with an org having dozens of different ways of doing subscriptions each with its own bespoke authentication/authorization madness.


Replies

couchand • today at 10:58 AM

Talk about throwing the baby out with the bathwater!

This comment illustrates quite clearly how naive GraphQL boosters are about prior art.