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

Add configuration to generate a client for a subset of the graph #1281

Open
paulpdaniels opened this issue Jan 31, 2022 · 3 comments
Open

Add configuration to generate a client for a subset of the graph #1281

paulpdaniels opened this issue Jan 31, 2022 · 3 comments
Labels
client GraphQL Client module enhancement New feature or request tools Issue related to Caliban tools like code generation or schema comparison

Comments

@paulpdaniels
Copy link
Collaborator

Currently client generation occurs for the entire graph, that is, when you generate from a schema you will end up with generated files for the entire schema regardless of if it is useful to you. I encountered this in #1280 when generating the client, the full schema contains about 500 types, since we only needed the types related to the reportSchema mutation this was overkill (and it prevents us from automatically generating the schema through the plugin).

We should allow the user to specify the names of top-level fields, Mutation.reportSchema for instance, and then perform a graph walk of the types that are used by that call to only resolve the types that are needed to satisfy those queries.

@paulpdaniels paulpdaniels added enhancement New feature or request client GraphQL Client module tools Issue related to Caliban tools like code generation or schema comparison labels Jan 31, 2022
@guizmaii
Copy link
Contributor

guizmaii commented Feb 9, 2022

FYI, with the "CompileTime plugin", you can generate your client for any given GraphQL[R] instance so you can generate a client for a subset of your global GraphQL[R] instance.

See https://ghostdogpr.github.io/caliban/docs/client-codegen.html#additional-information-about-compiletimecalibanplugin

@paulpdaniels
Copy link
Collaborator Author

Could yes if we control the original server. In this case though I have to build through introspection, because it is a server controlled by apollo

@paulpdaniels
Copy link
Collaborator Author

https://www.apollographql.com/blog/announcement/backend/apollo-router-is-now-generally-available/

Apollo just went GA with their router tool which is basically an ultra efficient reimplementation of apollo-server in rust. One thing we are looking at doing is creating an internal federation graph of all of our internal services so that we don't have 20 different clients. If we do having this would probably be a must to avoid having to generate 4k classes to use a single mutation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client GraphQL Client module enhancement New feature or request tools Issue related to Caliban tools like code generation or schema comparison
Projects
None yet
Development

No branches or pull requests

2 participants