-
Notifications
You must be signed in to change notification settings - Fork 111
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
Global decorators #190
Comments
One thing that would be useful to get a sense of from people with bigger codebases using genqlient (@Khan or elsewhere): how commonly useful would this be? Do you see lots of directives that get repeated basically everywhere a certain type is used, such that it would be simpler to make them global? |
From the Khan side: I agree this is most useful for Honestly, except maybe for |
edit: I guess |
Ah, interesting. I guess since Khan got to define the defaults that's not super surprising; it's the users using things like hasura that want this sort of thing. It's a good point that it's a bit magical, in any case, although I worry that the alternative is just adding config options to do the same things, which is not necessarily any less magical. |
If you want to apply some option to all cases where a particular field of a particular type is referenced in an operation (most commonly an input type) we have the
for
directive option for that. But you might want to do that not just for a single operation, but globally in yourgenqlient.yaml
, for example because some particular type always wantsomitempty
or suchlike. (This came up as a workaround in #187, which is a reasonable thing to want and would require several new features to implement otherwise.)It might be better to add proper features to avoid the need (e.g. in this case #178), but this could be a good way for schemas that find themselves needing these kinds of workarounds.This could potentially even subsume features likebind:
or a futurepointer: always
, although there are advantages to having the full power of YAML instead of our weird decorator-syntax.I think this would look something like
The text was updated successfully, but these errors were encountered: