i thought Graphql was confusing at first, merely because of their distinction of "Query" and "Mutation". It turns out (which I should've known), "Query" is just like GET requests where you are retrieving information and "Mutation" is like a POST/PUT/PATCH/DELETE requests that can modify the data.
After grasping this, Graphql was pretty similar to working with REST and a bit more flexible in how we want the data to be returned.
Graphql really does fix the whole "query multiple endpoints to construct a single data" dilemma.
Only thing I didn't like about it was the way Graphql schema is to be written in server side, thought it could be a bit more intuitive and simplified . Currently, it can get pretty verbose and breaks the DRY mantra. Would be nice if the Type system can be hooked up with the whatever ORM you are on (Mongoose, AR, Sequel) because you'll be re-mapping the fields to Graphql which can be an overhead for no reason.
Also schema is like working with SOAP's WSDL all over again. I used to hate it but it's back with Graphql so I'm trying hard to like it!
One of the nicest things of GraphQL is the type system indeed. You can use tools like https://www.prisma.io/, which generates a GraphQL backend based on your SQL database.
> Also schema is like working with SOAP's WSDL all over again.
Glad to hear that I'm not the only one who feels that way. I still like using simple tools like curl to try out APIs. It's so much easier to demonstrate an issue to a coworker when you can copy/paste a curl command in email/chat/PR. My (admittedly limited) experience with GraphQL so far has been that it makes this more awkward.
For me GraphQL adds a lot of complexity when setting up the API for only an incremental benefit when querying. Do others feel the same? Or am I missing something?
If you're using it to make simple queries the benefit over REST is incremental. But you can use it to get in one request all the data it would take your API clients many REST requests to gather, and then the benefit can be dramatic.
Looks like a low friction way to bring on new team members to GraphQL.
However, the tools is either broken or not finished yet. I tried to change posts to books in the JSON tab and I get an error below: "Cannot extend type "Post" because it does not exist in the existing schema."
Sorry for the cryptic error. That happens because the two objects in the comments array reference post_id. If you change those keys to book_id everything should work.
The algorithm for generating a GraphQL schema from a JSON object could be improved, along with its error handling. I use the algorithm from this repo: https://github.com/marmelab/graphql-schema-from-json. Error messages come from there.
I'll work on improving this tool and make it more user friendly. But I think that it is worth sharing it, even at this stage.
jaequery|7 years ago
After grasping this, Graphql was pretty similar to working with REST and a bit more flexible in how we want the data to be returned.
Graphql really does fix the whole "query multiple endpoints to construct a single data" dilemma.
Only thing I didn't like about it was the way Graphql schema is to be written in server side, thought it could be a bit more intuitive and simplified . Currently, it can get pretty verbose and breaks the DRY mantra. Would be nice if the Type system can be hooked up with the whatever ORM you are on (Mongoose, AR, Sequel) because you'll be re-mapping the fields to Graphql which can be an overhead for no reason.
Also schema is like working with SOAP's WSDL all over again. I used to hate it but it's back with Graphql so I'm trying hard to like it!
spell-slinger|7 years ago
One of the nicest things of GraphQL is the type system indeed. You can use tools like https://www.prisma.io/, which generates a GraphQL backend based on your SQL database.
davidcuddeback|7 years ago
Glad to hear that I'm not the only one who feels that way. I still like using simple tools like curl to try out APIs. It's so much easier to demonstrate an issue to a coworker when you can copy/paste a curl command in email/chat/PR. My (admittedly limited) experience with GraphQL so far has been that it makes this more awkward.
crispyporkbites|7 years ago
bhldr|7 years ago
nicwolff|7 years ago
ht85|7 years ago
spell-slinger|7 years ago
tapsboy|7 years ago
However, the tools is either broken or not finished yet. I tried to change posts to books in the JSON tab and I get an error below: "Cannot extend type "Post" because it does not exist in the existing schema."
spell-slinger|7 years ago
Sorry for the cryptic error. That happens because the two objects in the comments array reference post_id. If you change those keys to book_id everything should work.
The algorithm for generating a GraphQL schema from a JSON object could be improved, along with its error handling. I use the algorithm from this repo: https://github.com/marmelab/graphql-schema-from-json. Error messages come from there.
I'll work on improving this tool and make it more user friendly. But I think that it is worth sharing it, even at this stage.
Cheers!
mixedCase|7 years ago
spell-slinger|7 years ago
spell-slinger|7 years ago
monkeynotes|7 years ago