I have a graphql schema, where one (or more) of the nodes/types, is actually going to be a "proxy" to another graphql instance. The types that are exposed are defined by the secondary system and exposed in the public schema. What I would like to do is when I am in the node that needs to be proxied is to reconstruct a GQL query (String), but for only the field that I'm in, and all it's children. In the DataFetchingEnvironment I know what field I am currently in. If I use the Parser I can parse the the original query and get a Document object and get all other relevant info. I "simply" want to take the current field, and all it's variables and fragments used in that field, and construct a new query. Then I can simply invoke that query via a GraphQL client to the other system and return the value from that call.
Does this make sense? Is there any such mechanism? Any pointers on the best way to approach this?