Hacker News new | ask | show | jobs
by doctor_eval 1734 days ago
Can’t say I agree.. (1) you can easily create a json data type to emit arbitrary json in your response if that floats your boat (2) graphql queries can be far more expressive than straight json (3) graphql is just a REST call that takes a string and some optional JSON and returns JSON, no need for client side libraries unless you have complex use cases that are enabled by Graphql, (4) this has not been my experience, queries are run by the backend services, not by graphql itself, so the complexity of an individual backend query does not change.

Just my experience, we can agree to disagree!

1 comments

OK, it's true that you can't do recursive queries to arbitrary depth with standard GraphQL queries, but I think most people who are familiar with GraphQL would consider that a feature: the query and the returned object are the same shape, and this correlation has useful properties that I've exploited in the past.

Nevertheless, there are ways to include arbitrary JSON in GraphQL responses and since the JSON really is arbitrary, you can include any JSON you want, to any arbitrary depth, and the field parameters that drive the JSON query can themselves also be arbitrarily complex.

I'd say that's also a feature of GraphQL: easy things are easy and hard things are possible. But still, if you have a use case that requires this functionality then GraphQL might not be for you, and that's OK. Nobody's forcing you to use it.

I mean, GraphQL is also poor at serving binary data. You can just use a different endpoint for it. It's not an all or nothing thing.