Hacker News new | ask | show | jobs
by altrunox 2012 days ago
A while ago I decided to build another one of those Hacker News clone, and decided to use GraphQL, everything was fine, until I got at the comments...

You cannot ask for all the children of a main comment or a thread, something like "give me all the comments and sub comments of thread X" is impossible, I was quite shocked because I read nowhere about this limitation, I solved it adding an extra field to my response adding a "father" field, so I needed to organize and sort the data at the front-end, instead of using an already sorted JSON like would be possible with rest.

With all due respect, I find that most of GraphQL tests and examples return mostly simple data that is kinda easy anyways.

1 comments

Could you elaborate please. I don't understand the issue surely you could model this on the backend and serve it via GraphQl?
I think he is saying graphql doesn't have recursion.
Well yes, that would be a better way to say it, no recursively nested objects, there is a Github discussion about it here:

https://github.com/graphql/graphql-spec/issues/91

And if someone else is interested to take a look at my clone project (it's in Clojure), for the GraphQL issue you can search for "request recursively nested objects".

https://www.giovanialtelino.com/project/hacker-news-graphql/

Thanks! That is really good to know. I wasn't aware of that limitation.