graphql 2024-04-22

is there something like hugsql but for graphql? Would be good to avoid keeping all the graphql queries in massive strings in the code

I think the equivalent is: keep the graphql strings in a separate file, and slurp and include the parameters for a request

yeah sure it's easy to do I guess

there are some libs out there that try to give a honeysql-like experience to manipulating gql, e.g. https://github.com/r0man/grafeo

even if you want to keep the gql in separate files, they have useful utilities (e.g. parsers) that might make it easier to build something a little bit richer than slurp

e.g. they could validate, resolve fragment references to other files and include those too, generate an arglist or spec for the input parameters, etc.

maybe you could generate vars in a ns from a directory of gql files, where each var = the operation or fragment name with arguments

not sure how deep you want to go with this πŸ™‚

yeah well that's why I asked if there was something already πŸ˜„

since I'd like to use it but not do it myself πŸ˜„

AFAIK people are only bringing gql into clojure (alternate syntaxes), not making it easier to reference and β€œcall” existing gql in other files.

This is the most like hugsql for graphql that I know of: https://github.com/retro/graphql-builder

ah thanks looks good