-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Omit fields from a query #336
Comments
Hi @Goddchen - have you had a look at the |
Hey @budde377 . Yeah we did have a look at As I mentioned, just using different queries works fine as long as you have only 1 or 2 fields. Since it grows exponentially and we sometimes have 5 or 6 affected fields, this is unfortunately not an option. |
Okay so if I understand the problem correctly you electively want to write your queries to multiple schemas depending on some input. Having multiple queries doesn't work for you because you foresee an exponential blow up. In short the codegen doesn't support dynamic queries; the operations you write are the one that are sent. There might be an argument for an operation preprocessor who could figure out this and only send the right query but I think it requires more work and thought. Until then, I'd advise you to think if you can't impose some constraints on your api. I'd expect your use case is usually handled by establishing good release guaranties and deprecation policies. But I of course don't know your use case in detail. |
TLDR: it's not possible right now. Yeah you're totally right. Thanks for looking into it. |
I'm facing the following scenario: In some cases (like feature flags being set or not set) I want to omit a response fields completely from a query sent to the server. The reason: the server does not support this field yet, for example, so it would throw an exception, because it does not know about this field (yet).
How could I achieve this? I have already read about how to achieve it with inputs in the issues section, but how do I do it with query response fields?
Using two different queries for it is not really an option, because a query can contain multiple of those response fields and that would generate a lot of queries real quick 😉
Some example to illustrate this (hand-written pseudo code, can contain syntax errors 😉):
Right now we'd do something like this, writing the query manually:
Is this possible in any way with
graphql_codegen
?Thanks
The text was updated successfully, but these errors were encountered: