Khan / genqlient

a truly type-safe Go GraphQL client
MIT License
1.03k stars 99 forks source link

Split generated.go output to different files according to operations files name on generate #248

Closed ercross closed 1 year ago

ercross commented 1 year ago

Is your feature request related to a problem? Please describe. The generated.go file may easily become too long and hard to maintain because all query functions are written into it

Describe the solution you'd like With gqlgen, resolvers may be configured to be generated into different files based on schema file names. A similar approach should be employed here, where instead of writing all query functions into one single file (i.e., generated.go), query functions are written in file corresponding to their operations filename. For instance, if

operations:
     - queries.graphql
     - mutations.graphql
     - types.graphql     

The generated output should be

generated:
     - queries.go
     - mutations.go
     - types.go # provided types.graphql contains any query, mutations
benjaminjkraft commented 1 year ago

Dupe of #185. If you could, it would be helpful to have comments on that issue describing why this is useful to you and how it should work to solve your problem -- for example why is it an issue that the generated file is so long (you're not really intended to look at it by hand).