I’m looking for a GraphQL generator for Rescript. I found: https://github.com/reasonml-community/graphql-ppx, but it mentions ReasonML a lot to the point that I’m unsure if I should use Rescript or deprecated ReasonML.
I also found: https://www.graphql-code-generator.com/docs/plugins/reason-client but it seems to be outdated and referring only to ReasonML.
I would like to generate Rescript types from GraphQL schema. What are you using in your projects with GraphQL?
We are using graphql-ppx and apollo-client but would like to hear more about any plans here too
We use RescriptRelay, the back-end is generated for us by Hasura. RescriptRelay is a fantastic library with excellent tooling, and for us is worth the additional learning curve over Apollo GraphQL.
We use rescript-relay over a postgraphile based backend with great joy too
@mishaszu: Maintainer here. It still mentions ReasonML, but that’s documentation that needs to be fixed (PRs welcome BTW). I am talking to the ReScript team to make some changes and make the architecture of the ppx more in line with the ReScript philosophy (and also probably change the name). But that will not change much, user-facing. The ppx is in in production use at some reasonable large companies, and is still under active development (recently added
schema.graphql parsing). I recently started working at Walnut, which is using the ppx, and have some time allocated to spend in OSS.
If you are using Relay I can also recommend
rescript-relay, this works by generating code instead of a ppx which is possible because it leverages the Relay compiler.
PS: from a technical perspective, there is no difference in supporting ReScript or ReasonML syntax as they work on the same syntax tree, which is what the ppx is operating on.
But I will rewrite all the examples to ReScript soon!
We exclusively use RescriptRelay and it is amazing
RescriptRealy looks awesome! I just need to verify if my Rust Juniper backend can handle Relay (it’s not officially supported), if no I will try
graphql-ppx + Apollo.
I checked react-relay documentation and the whole tool is amazing! Thanks a lot for your suggestions!
Generating ReScript types from GraphQL (schema-first) is ideal on the front-end.
But on the back-end it might be ideal to go the other way around. To generate the GraphQL schema from the ReScript types (code-first).
For those interested - who like me came across this “GraphQL generator” topic you’re currently reading - the “generate GraphQL from ReScript” approach can be discussed here: