★ wanayoo — archive 1999 https://github.com/graphql-java/graphql-java/issues/422Nouvelle recherche | Portail wanayoo
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

Create a text query from the current DataFetchingEnvironment's field (and Document). #422

Closed
acidbluebriggs opened this issue May 10, 2017 · 9 comments
Milestone

Comments

@acidbluebriggs
Copy link

@acidbluebriggs acidbluebriggs commented May 10, 2017 •

(Originally posted to the google group, but I saw a message about closing the group that it's not really used)

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?

@bbakerman
Copy link
Member

@bbakerman bbakerman commented May 11, 2017

Yup - recently added

See : #377

Its not released yet but 3.0 is coming soon-ish

@bbakerman
Copy link
Member

@bbakerman bbakerman commented May 11, 2017

See : https://github.com/graphql-java/graphql-java/blob/master/src/test/groovy/graphql/schema/DataFetcherSelectionTest.groovy

This use the new IDL support to "print the current field selection including sub felds" and that could be used to send it on to a proxy

@bbakerman bbakerman added the duplicate label May 11, 2017
@bbakerman bbakerman added this to the 3.0.0 milestone May 11, 2017
@acidbluebriggs
Copy link
Author

@acidbluebriggs acidbluebriggs commented May 11, 2017

@bbakerman
Copy link
Member

@bbakerman bbakerman commented May 11, 2017

It was not possible before to call FieldCollector via API. And then there was no IDL print support in 2.4 either to allow you to reverse engineer a parsed Document back into text format.

These have been added in 3.0 plus a bunch of other goodies

The future readme has more info

https://github.com/graphql-java/graphql-java/blob/master/src/test/groovy/graphql/schema/DataFetcherSelectionTest.groovy

@acidbluebriggs
Copy link
Author

@acidbluebriggs acidbluebriggs commented May 11, 2017

@acidbluebriggs
Copy link
Author

@acidbluebriggs acidbluebriggs commented May 11, 2017

Sorry, one last question... and you can close this... how stable is master?

@andimarek
Copy link
Member

@andimarek andimarek commented May 11, 2017

@acidbluebriggs master is not stable at all: it is the current development branch, so we can't promise anything.

@andimarek andimarek closed this May 11, 2017
@ieugen
Copy link

@ieugen ieugen commented May 11, 2017

@acidbluebriggs : Sorry for re-opening, but maybe a git flow approach is better suited to having a stable version and a development version.

@andimarek
Copy link
Member

@andimarek andimarek commented May 11, 2017

@ieugen this issue is not about our workflow, so please open a new one if you have a question or recommendation how we can improve things. thanks!

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.