Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stormsweeper opened this issue Apr 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@stormsweeper
Copy link

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
Copy link
Collaborator

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

@benjaminjkraft benjaminjkraft closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
benjaminjkraft added a commit that referenced this issue Apr 5, 2024
It's really quite reasonable to want this to work -- you want to say to
look for queries in `pkg/**/*.graphql`, or `**/queries/*.graphql`, or
whatever. Now it does. I picked `doublestar` because it seemed a
reasonable combination of popular and well-documented.

Fixes #167. Hopefully obsoletes #327.

I have:
- [x] Written a clear PR title and description (above)
- [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla)
- [x] Added tests covering my changes, if applicable
- [x] Included a link to the issue fixed, if applicable
- [x] Included documentation, for new features
- [x] Added an entry to the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants