graphql

2024-04-22T14:35:47.141529Z

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

favila 2024-04-22T14:39:20.054709Z

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

2024-04-22T14:39:59.399169Z

yeah sure it's easy to do I guess

favila 2024-04-22T14:40:37.318889Z

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

favila 2024-04-22T14:41:35.727029Z

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

favila 2024-04-22T14:42:19.231579Z

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.

favila 2024-04-22T14:43:56.687829Z

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

favila 2024-04-22T14:44:23.019549Z

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

2024-04-22T14:48:52.997599Z

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

2024-04-22T14:49:02.236159Z

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

favila 2024-04-22T14:49:59.767639Z

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

2024-04-22T16:04:00.421359Z

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

souenzzo 2024-04-23T00:08:38.631169Z

Checkout https://github.com/edn-query-language/eql-graphql

2024-04-24T08:11:18.084239Z

ah thanks looks good