-
Notifications
You must be signed in to change notification settings - Fork 426
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
GraphQL schema stiching #743
Comments
We will likely never support this. Juniper's schema is defined at compile time, not runtime. |
@LegNeato It is something that is feasible to do at runtime. The upstream types would be opaque. This is a pass-though feature, not something that would generate types. |
You may be interested in Federation if/when that is implemented in Juniper. From my understanding it does what you describe and although it was started by the Apollo team, there is an open specification for implementing it in different languages. |
This doesn't need to be in Juniper though, right? From what I know (not much!) It is probably handled by a higher level that chooses this part of the graph -> call Am I thinking about it wrong here? |
@LegNeato I'm afraid I'm not very familiar with Juniper or with the Federation spec, but I'll try to answer your question as best I can. Generally speaking, Federation consists of two parts: a gateway and a number of implementing services. The gateway implements the higher level logic that determines which implementing services to call for each part of the graph, which I think you're referring to. I think being able to create a Federation implementing service using Juniper would be a great start. This alone would deliver a lot of value as it would let anyone write GraphQL microservices in Rust as part of a Federation graph. While certainly nice to have, the Federation gateway doesn't need to be implemented in Rust initially. Because Federation is based on a specification, people can use Apollo's Federation Gateway Node.js package until someone decides to implement the gateway spec in Rust. Either way, I agree the gateway probably doesn't need to be in Juniper. There was some discussion in #376 about what changes to Juniper are required to be able to create a Federation implementing service, specifically these two comments. |
@mickdekkers You are correct, I believe Federation is better than stitching, but I didn't know of its existence until your comment. Then I saw this: https://www.youtube.com/watch?v=ra5WuUvQRIM The federation gateway can be a different crate. |
Sorry for necro-bumping this but i've hit this issue as well.
@LegNeato i tried your approach:
It would be a lot more ergonomic if one could mark a resolver to only pass the variables and query along into the resolver to be able to call an upstream graphql api. Since (i guess) it would be hard to have juniper to know about the structure of the remote response due to its code first architecture, maybe it would be possible to get the response as a String, possibly serde_json::Value, and have juniper "inject" it into the response at the right search path. I'm pretty new to graphql in general so I'm open if someone has a better solution / any other pointers :) edit: I've implemented storing the path(s) to the remote gql query in the original query to be able to inject the remote response into the right path of the response while combining the results. Surely there are edge cases which i haven't thought about and it doesn't feel very ergonomic |
Is your feature request related to a problem? Please describe.
I would like to be able to specify that part of my schema is found on an upstream server, and I'd like it updated when an upstream server updates.
A clear and concise description of what the problem is.
I can't combine my microservices without using Apollo Server.
Describe the solution you'd like
I'd like a way to point to a server to fill in the types that the current server doesn't know about, and then be able to return one of those types in a resolver. I'd also like input types to be proxied through as well.
Describe alternatives you've considered
Apollo Server can do schema stiching, and may be a good starting place for how it should be done in Juniper.
The text was updated successfully, but these errors were encountered: