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

Support Codegen of Operations without Response Models #3165

Open
Iron-Ham opened this issue Jul 31, 2023 · 3 comments
Open

Support Codegen of Operations without Response Models #3165

Iron-Ham opened this issue Jul 31, 2023 · 3 comments
Labels
codegen Issues related to or arising from code generation feature New addition or enhancement to existing solutions

Comments

@Iron-Ham
Copy link
Contributor

Use case

I would like to be able to generate the operations independent of the response models, such that the response models (initially) return a JSON dictionary.

Describe the solution you'd like

No response

@Iron-Ham Iron-Ham added the feature New addition or enhancement to existing solutions label Jul 31, 2023
@calvincestari
Copy link
Member

@Iron-Ham are you still wanting the type-safe parsing of the GraphQL executor? If so then would simply exposing the raw JSON response suffice?

@Iron-Ham
Copy link
Contributor Author

Iron-Ham commented Aug 1, 2023

I filled out a pretty sparse issue here -- so perhaps I can help illuminate my use-case and my thoughts:

Since we have to support n schemas, where n-1 schemas are a snapshot of our live schema, we end up generating n operations and response models (we don't want to request properties or send inputs that don't exist on a given schema version). Then, we separately generate an interface over each of these models and operations. But the more versions that we support, the larger the mass of generated code we have in our binary.

My thought:

In effect, we are associating a new (Apollo codegen flavored) model with n operations. Could we cut out the generation of the n response models, and instead just generate one set of response models that we can then associate to our operations? That association doesn't have to be done automatically -- since they can be instantiated via JSON, we can just one-line it ourselves.

The concern is basically being able to cut down on our binary.

@AnthonyMDev AnthonyMDev added this to the Minor Releases (1.x) milestone Sep 15, 2023
@AnthonyMDev AnthonyMDev added the codegen Issues related to or arising from code generation label Nov 10, 2023
@alex-king-ck
Copy link

We could potentially use this functionality as well, but we'd still want models generated at the top level, and the ability to skip code generation on a subset of an operation's query if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen Issues related to or arising from code generation feature New addition or enhancement to existing solutions
Projects
None yet
Development

No branches or pull requests

4 participants