News for hackers. Stuff that matters.
Re:REST and GraphQL really aren't that different by dopeboy on Wednesday January 30, 2019 @02:31PM (#19038437)
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.

Re:REST and GraphQL really aren't that different by iooi on Wednesday January 30, 2019 @02:58PM (#19038770)
Re:REST and GraphQL really aren't that different by Blackstone4 on Wednesday January 30, 2019 @02:58PM (#19038775)
Aside 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

  }

}
Re:REST and GraphQL really aren't that different by nmadden on Wednesday January 30, 2019 @02:51PM (#19038684)
Really? It’s called GraphQL and its schema can’t describe a simple tree?
Re:REST and GraphQL really aren't that different by Twisol on Wednesday January 30, 2019 @03:02PM (#19038815)
The 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.
Re:REST and GraphQL really aren't that different by napoleond on Wednesday January 30, 2019 @03:03PM (#19038819)
A 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.