-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add support for extensions #183
Comments
Thanks for raising this! I think adding an option makes a lot of sense. The only thing I want to discuss a little is where and how to represent it. For where, in GraphQL generally the (One slight awkwardness there is that we may need to change the Then the other question is what type it should be. Of course |
Thank you for that rapid response! The signature of Regarding typing, at least speaking for me and my use case, I don't see the added benefit of having that in the config file. The reason being is, that validation at code generation is not possible, so type failures at runtime could happen. In that case, I would rather consume it as is ( |
Yeah, that's right. Having it behind an option is both for backwards compatibility, and to avoid having to always do
Heh, I hadn't fully thought it through, but I think the idea was the generated code would do a type-assertion to see if your
Sure, makes sense! We can just start with |
The only use of MakeRequest that I see is in our adapter code, which just delegates to upstream after doing some configuration, and this code:
So I think it should be straightforward to change the code if the MakeRequest API changes. |
That all sounds very reasonable to me! I'll try to come up with a PR in the next few days/weeks. |
Is your feature request related to a problem? Please describe.
I want to access the data returned in the Extensions field, as defined in the response format: https://spec.graphql.org/October2021/#sec-Response-Format
A challenge is, that this data is untyped and not defined in the schema itself.
Describe the solution you'd like
Add a configuration flag to
genqlient.yaml
, likeuse_extensions
, to toggle generating Extensions fields in resulting objects. Example for the resulting, generated code:Extensions would be added after unmarshaling the data by the graphlql client.
Describe alternatives you've considered
Enabling it on a per-query basis via comment
Additional context
I am willing to provide a PR once the design is settled.
The text was updated successfully, but these errors were encountered: