You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been looking through the documentation and searching online on my own, but I haven't been able to find an example or anything similar.
What I'm trying to achieve with this tool is to create a gateway between our clients (servers) and a supergraph exposed via the Apollo Router. We need to intercept the queries made to this supergraph to:
Add specific fields to the query
Modify the values of certain fields
Change the structure of the response to simplify it
I'm not sure if this is possible with the current setup or if the best approach would be to expose a new GraphQL server with the supergraph as the provider.
Thanks in advance! Any help or suggestions are welcome.
The text was updated successfully, but these errors were encountered:
Hi!
I am doing similar stuff in my project. I have graphql gateway and service which modifies request before passing it to gateway. The graphql-go-tools is correct tool for such a scenario.
If you take a look at example of gateway in the repository:
get request and unmarshall JSON
use astparser.ParseGraphqlDocumentString to get ast.Document
use astvisitor.Walker to go through query and mutate it, you can take a look how astnormalizer works or astvalidation. They are really cool examples
forward modified query to graphql-go-tools engine
Regarding modifying response I will not help you because we do not do this. My feeling is that you'd need to implement it on your own.
In addition to @phob0s-pl answer, the execution package has a proxy mode that will allow you to have a single datasource and use the engine for the validation goals
For modifying something you could use custom HTTP transport with roundtripper
This example should give you initial knowledge on how to use validation, normalization, and other things
I've been looking through the documentation and searching online on my own, but I haven't been able to find an example or anything similar.
What I'm trying to achieve with this tool is to create a gateway between our clients (servers) and a supergraph exposed via the Apollo Router. We need to intercept the queries made to this supergraph to:
I'm not sure if this is possible with the current setup or if the best approach would be to expose a new GraphQL server with the supergraph as the provider.
Thanks in advance! Any help or suggestions are welcome.
The text was updated successfully, but these errors were encountered: