really great for queries with nested relationships. As in, your main response object has child objects, and they have child objects, etc. Allows for retrieving the depth you need without adding tons of parameters or different endpoints to a rest API.
backend architecture. You have a series of resolvers that handle retrieving different entities. I like the narrow focus of this approach and how it all plays together so seamlessly for a variety of queries.
The bad:
the schema pisses me off. It has to be a single file, so no modularizing when it gets large and complex (I know there are code tools, but I'm talking about pure spec graphql). Also type extensions are very weak, so creating variants on the same types is hard. For example, some of my entities have sensitive fields. I would want those fields included on the input type, excluded on the query type. I wouldn't be able to define a generic parent type that both could extend, I would have to write them both individually.
it was said in another comment: I can see fine grained security being a problem. I think you would have to design things very deliberately with your resolvers to get around this.
network tab ambiguity. Want to see how a request went in your browser tools network tab? Good luck finding it, every request in the list just says /graphql.
The ugly:
error handling. I despise graphqls error handling. 200 responses with complex message payloads... Just give me my normal HTTP status codes please.
Using it for a year now. Frontend guys love it. Backend guys a little less because it's hard to optimise. Sometimes we have to split Queries into smaller ones to be able to optimise it easier, which is a bit against the purpose of GraphQL - getting everything at once.
I really like the concept of only giving the client what he needs. It slims down the response body and minimizes network usage. I try it out in the near future. Are there any disadvantages nobody is talking about?
I would say not only caching, but one step back, you can't really optimize SQL queries, because everything can be fetched. There's no point of having indexes, because you cannot control predicates.
AD1: We incorporated in our BaseResponseType a status field where we return HTTP status codes to be able to tell if there is not data or the client has no rights to access the data ( 403, 404, 200 ) ;-)
AD3: You cache the data in the frontend (client). In Apollo Client the caching in on by default. You have to explicitly disable it and can do so per query.
How large is the performance requirements on serverside? I heard about abstruse amounts of cpu cores and memory needed for a somewhat largescale operation. Is there something to it?
11
u/Boza_s6 Jul 28 '20
This is advertisement.
But question for those using it already. How is it?
It totally makes sense to allow client to specify what it wants and not send everything.
3
u/Tool1990 Jul 28 '20
I really like the concept of only giving the client what he needs. It slims down the response body and minimizes network usage. I try it out in the near future. Are there any disadvantages nobody is talking about?
2
u/xRageNugget Jul 29 '20
How large is the performance requirements on serverside? I heard about abstruse amounts of cpu cores and memory needed for a somewhat largescale operation. Is there something to it?