Let's first analyze how to write the queries. I experimented the
graphql_ppx with a few different features (nullable and non-nullable variables, fragments, convert response into record automatically). The type safety is very neat, both the input variables and the response have specific types (no
Js.Json.t!), and the queries/mutations are validated against the schema! This makes it really easy to write queries, although I worry about integrating new versions of the schema since the repos are separated (we should probably re-fetch the schema as part of the CI).
As for the drawbacks, there are not many:
- The ppx really messes up my language server sometimes.
- I haven't tried a lot but I couldn't find easily a way to use refmt to format the queries.
- I couldn't find anything about custom directives, the lack of which would prevents us from using some features from the GraphQL clients (for example, managing local state using Apollo's
- I haven't