5 ms·
Except when they are. I was just implementing an endpoint that returns Reddit like comment data (replies nested in replies) and I quickly realized you can't pul
by dopeboy 8y ago
Except when they are. I was just implementing an endpoint that returns Reddit like comment data (replies nested in replies) and I quickly realized you can't pull this off in graphql because the return structure has to be predefined and static.
Ended up implementing it in REST.
- nmadden 8y agoReally? It’s called GraphQL and its schema can’t describe a simple tree?
- Twisol 8y agoThe schema certainly can, but GraphQL queries have the valuable (in many but not all contexts) property that the response structure mirrors the request structure. If your request is nested no deeper than four scopes, then the response will also be nested no deeper than four scopes.
- napoleond 8y agoA GraphQL schema can easily define a tree but AFAIK the client must specify the desired recursion depth on that tree. This kind-of makes sense for the same reason that paginating list resources makes sense, but I can see how it would be annoying.
- iooi 8y agoFirst result from Google: https://github.com/facebook/graphql/issues/91 https://github.com/facebook/graphql/issues/91
- Blackstone4 8y agoAside from the fact you can return JSON types as a catch all. It is possible to imbed types within types in GraphQL I.e. Post { Comments { Comments } }