Live data from Hacker News

GraphQL: The enterprise honeymoon is over

johnjames.blog

121–130 of 241 posts

Re: GraphQL: The enterprise honeymoon is over

#121
I work on an open source server project that is deployed in many different contexts and with many different clients and front ends. GraphQL has allowed us to not feel bad about adding extra properties and object to the response, because if a particular client doesn’t want them, they don’t request them and don’t get them. It has allowed us to be much more flexible with adding features that only few people will use.

Re: GraphQL: The enterprise honeymoon is over

#122
post #111

Earlier quoted context omitted.

Graphql solves the problem. There is no problem here for openapi to solve. See how that works?

Openapi is older than graphql. But the point is that that benefit is not unique to graphql, so by itself, that is not a compelling reason to choose graphql over something else.

Yeah that was one point of many of the benefits of the parent.

Re: GraphQL: The enterprise honeymoon is over

#123
I tend to agree with the author. GraphQL has its use cases, but it is often times overused and simplicity is sacrificed for perceived elegance or efficiency that is often times not needed. "Pre-mature optimisation of root of all evil" comes to mind when GraphQL is picked for efficiency gains that may never become a problem in the first place.

Facebook invented GraphQL to solve a very specific problem back in 2012 for mobile devices. Having to make multiple queries to construct the data needed in FE in mobile clients is bandwidth constraining (back then over 3G networks) and harmful for battery life, so this technology solved this problem neatly. However, these days when server-to-server communication is needed over an API, none of the problems Facebook invented the protocol for are problems in the first place. If you really want maximum efficiency or speed you probably ought to ditch HTTP entirely and communicate over some lower level binary protocol.

REST is not perfect either, one thing I liked about SOAP was that it had a strong schema support and you got to name RPCs the way you liked, and didn't have to wrangle everything around the concept of a "resource" and CRUD operations, which often times becomes cumbersome to fit into the RESTful way of thinking if you need to support an RPC that "just does magic with multiple resources". These are the things I like about GraphQL, but on the other hand REST is just HTTP with some conventions, which you necessarily don't have to follow if things get in your way, and is generally simpler by design.

The only thing I wish with REST is having a stronger vendor support for Swagger/OpenAPI specs. One of the things my team supports is a concept of Managed APIs for our product: https://docs.adaptavist.com/src/latest/managed-apis and we support primarily RESTful APIs but also couple of GraphQL based ones and the issue we face is that REST API specs for many products are either missing, incomplete or simply outdated, so we have to fix them ourselves before we generate our Managed API clients, or write them by hand if the specs don't exist. It's becoming easier with AI these days, but one thing I personally regret when we transitioned from SOAP to REST as a community, is that the strong schema support became a secondary concern. We no longer could just throw API client generator at SOAP's WSDL and generate a client, we needed to start handcrafting the clients ourselves for REST, which is still an issue to this day, unless perfect specs exists, which in my experience is a rather rare occurrence.

Re: GraphQL: The enterprise honeymoon is over

#124

Earlier quoted context omitted.

And the fetching in a single request?

The question I answered was regarding contracts. Fetching in a single request can be handled by your BFF.

So make things more complicated than gql?

Re: GraphQL: The enterprise honeymoon is over

#125
post #98

Earlier quoted context omitted.

As someone who’s used GraphQL since mid-2015, if you haven’t used GraphQL with Relay you probably haven’t experienced GraphQL in a way that truly exploits its strengths. I say probably because in the last ~year Apollo shipped functionality (fragment masking) that brings it closer. I stand by my oft-repeated statement that I don’t use Relay because I need a React GraphQL client, I use GraphQL because I really want to…

Can you elaborate? I've used URQL and Apollo with graphql code gen for type safety and am a big fan. What about relay is so compelling for you? I'm not disagreeing, just genuinely curious since I've never really used it.

For me it’s really about the component-level experience.

* Relatively fine-grained re-rendering out of the box because you don’t pass the entire query response down the tree. useFragment is akin to a redux selector

* Plays nicely with suspense and the defer fragment, deferring a component subtree is very intuitive

* mutation updaters defined inline rather than in centralised config. This ended up being more important than expected, but having lived the reality of global cache config with our existing urql setup at my current job, I’m convinced the Relay approach is better.

* Useful helpers for pagination, refetchable fragments, etc

* No massive up-front representation of the entire schema needed to make the cache work properly. Each query/fragment has its own codegenned file that contains all the information needed to write to the cache efficiently. But because they’re distributed across the codebase, it plays well with bundle size for individual screens.

* Guardrails against reuse of fragments thanks to the eslint plugin. Fragments are written to define the data contract for individual components or functions, so there’s no need to share them around. Our existing urql codebase has a lot of “god fragments” which are very incredibly painful to work with.

Recent versions of Apollo have some of these things, but only Relay has the full suite. It’s really about trying to get the exact data a component needs with as little performance overhead as possible. It’s not perfect — it has some quite esoteric advanced parts and the documentation still sucks, but I haven’t yet found anything better.

Did my only ever podcast appearance about it a few years ago. Haven’t watched it myself because yikes, but people say it was pretty good https://youtu.be/aX60SmygzhY?si=J8rQF6Pe5RGdX1r8

Re: GraphQL: The enterprise honeymoon is over

#126
post #120
post #111

Earlier quoted context omitted.

Openapi is older than graphql. But the point is that that benefit is not unique to graphql, so by itself, that is not a compelling reason to choose graphql over something else.

plus now you have 2 sources of truth

? I have a single source of truth in the gql schema. My frontend calls are generated from backend schema and type checked against it.

Re: GraphQL: The enterprise honeymoon is over

#127

> The main problem GraphQL tries to solve is overfetching. My issue with this article is that, as someone who is a GraphQL fan, that is far from what I see as its primary benefit, and so the rest of the article feels like a strawman to me. TBH I see the biggest benefits of GraphQL are that it (a) forces a much tighter contract around endpoint and object definition with its type system, and (b) schema evolution is muc…

Agree whole-heartedly. The strong contracts are the #1 reason to use GraphQL. The other one I would mention is the ability to very easily reuse resolvers in composition, and even federate them. Something that can be very clunky to get right in REST APIs.

Contracts for data with OpenAPI or an RPC don't come with the overhead of making a resolver for infinite permutations while your apps probably need a few or perhaps one. Which is why REST and something for validation is enough for most and doesn't cost as much.

Re: GraphQL: The enterprise honeymoon is over

#128

I don't like GraphQL, it feels strange for me (for my rest brain) despite many Rest flaw that I know that it feels tedious sometimes, I still prefer that and now with AI that can scaffold most rest. the pain point of rest mostly "gone" now that people using a lot of Trpc, I wonder can we combine Grpc + rest that essentialy typesafe and client would be guaranteed to understand how model response look ?????

Yes you can. Check out https://fate.technology

Re: GraphQL: The enterprise honeymoon is over

#129

I get the impression that GraphQL only got popular because it was backed by behemoth Facebook. But the other graph query language "Cypher" always seemed a lot more intuitive to me. Are they really trying to solve such different problems? Cypher seems much more flexible.

Cypher tries to solve problems closer to storage.

GraphQL was designed to add types and remote data fetching abstractions to a large existing PHP server side code base. Cypher is designed to work closer to storage, although there are many implementations that run cypher on top of anything ("table functions" in ladybug).

Neo4j's implementation of cypher didn't emphasize types. You had a relatively schemaless design that made it easy to get started. But Kuzu/Ladybug implementation of cypher is closer to DuckDB SQL.

They both have their places in computing as long as we have terminology that's clear and unambiguous.

Look at the number of comments in this story that refer to GraphQL as GQL (which is a ISO standard).

Re: GraphQL: The enterprise honeymoon is over

#130

I have strong agreement here and would add reasoning about auth flow through nested resolvers is one of the biggest challenges because it adds so much mental overhead. The reason is that a resolver may be called through completely different contexts and you have to account for that The complexity and time lost to thinking is just not worth it, especially once you ship your GarphQL app to production, you are locking d…

Authz overhead for graphql is definitely a problem. At GitHub we're adding github app support to the enterprise account APIs, meaning introducing granular permissions for each graphql resource type.

Because of the graph aspect, queries don't work til all of the underlying resources have been updated to support github apps. From a juice vs squeeze perspective it's terrible - lots of teams have to do work to update their resources (which given turnover and age they may not even be aware of) before basic queries start working, until you finally hit a critical mass at some high percentage of coverage.

Add to all that the prevailing enterprise customer sentiment of "please anything but graphql" and it's a really hard sell - it's practically easier and better to ask teams to rebuild their APIs in REST than update the graphql.

Post reply on HN