Khan / genqlient

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

Allow globs for schema/queries to be optional, if at least one file is found #327

Closed stormsweeper closed 3 months ago

stormsweeper commented 3 months ago

Is your feature request related to a problem? Please describe. When running generation, and any glob in the config does not match any files, an error is returned and generation fails.

In our particular case, we have current SQL-based files inside dirs in lib/models, and we'd like to put graphql operations in files in those directories. Thus:

operations:
- "lib/models/*/*.graqhql"

However, we do have some nested models (e.g. lib/models/foo/bar), but if we add

- "lib/models/*/*/*.graqhql"

then the generation will exit unless actual files exist.

Describe the solution you'd like Ideally, this should allow some globs to fail but warn instead. This would allow us to add/remove the query files as needed, without having to also update the genqlient config.

Describe alternatives you've considered We could add/remove the directory lines as we add/remove the files. Just a bit of extra work.

Additional context

benjaminjkraft commented 3 months ago

As I commented on #328 -- let's do #167 instead.