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

FR: Federation and/or multiple graphs/subgraphs #245

Open
hinogi opened this issue Sep 18, 2022 · 5 comments
Open

FR: Federation and/or multiple graphs/subgraphs #245

hinogi opened this issue Sep 18, 2022 · 5 comments

Comments

@hinogi
Copy link

hinogi commented Sep 18, 2022

Are there any plans to add support for working with multiple graphs in the sense of Graphql Federation with distributed graphs where you can see where the dependencies jump to a different graph?
It might be over complicated but usually there is some kind of SDL hint on what graph to jump to.

@LunaticMuch
Copy link
Collaborator

That's an interesting point, but not sure how it could be done.

From the top of my mind, if you query the gateway, it won't let you know about subgraph and this is intended.
You could potentially query all subgraphs and put together information, but won't be effective I suspect. I feel the only way would be to manually put together all the schema files and follow where the schema is extended, evaluating apollo specific directives. It feels hard.

From a consumer perspective, I am not sure about the value provided, as the consumer actually should be aware of the backend (federated or not, and how it's being federated). From a tooling perspective, it could help but not sure to which extent 🤔

@hinogi
Copy link
Author

hinogi commented Sep 18, 2022

It is actually more difficult, you have an SDL and an API. You can see that concept in the seldom known apollo workbench. It holds also information about the name of the subgraphs. In the example the LOCATIONS subgraph is shown. So there is a graph with information on what graphs are available and which field in which graph is external and in which not, it is only one hell of AST crawling away ;)

https://www.apollographql.com/docs/federation/v1/workbench/overview#view-supergraph-and-api-schemas

@hinogi
Copy link
Author

hinogi commented Mar 3, 2024

That's an interesting point, but not sure how it could be done.

From the top of my mind, if you query the gateway, it won't let you know about subgraph and this is intended. You could potentially query all subgraphs and put together information, but won't be effective I suspect. I feel the only way would be to manually put together all the schema files and follow where the schema is extended, evaluating apollo specific directives. It feels hard.

From a consumer perspective, I am not sure about the value provided, as the consumer actually should be aware of the backend (federated or not, and how it's being federated). From a tooling perspective, it could help but not sure to which extent 🤔

I guess you could use https://the-guild.dev/graphql/tools/docs/api/modules/merge_src to merge multiple .graphql files into one before using it into voyager

@LunaticMuch
Copy link
Collaborator

I guess you could use https://the-guild.dev/graphql/tools/docs/api/modules/merge_src to merge multiple .graphql files into one before using it into voyager

I depends what you aim or look for. Reading files is ok, but if you then generate an SDL you are gonna be stuck because the SDL will not contain any info. An option is to read the sdl field from each subgraph which. would return the unparsed copy of the sdl. Still, you need to decide what to do with that and how to inject additional info on the UI

@hinogi
Copy link
Author

hinogi commented Mar 6, 2024

https://github.com/apollographql/supergraph-demo-fed2/blob/main/supergraph/schema/docker.graphql

looking at that example, it really sounds like a nightmare :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants