Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Anyway to recreate the query from the parsed AST #102

Open
chrisjowen opened this issue Aug 26, 2016 · 3 comments
Open

Anyway to recreate the query from the parsed AST #102

chrisjowen opened this issue Aug 26, 2016 · 3 comments

Comments

@chrisjowen
Copy link

Hey there,

Just looking through I can see that I can parse the AST with GraphProxy.Query, I just wondered if there was any way to recreate that query back from the AST to a string?

Chris

@joshprice
Copy link
Member

Hi!

There isn't a way right now to recreate the query from the AST. What would you use it for exactly?

Also not sure what GraphProxy.Query is, got a link?

@chrisjowen
Copy link
Author

Lol sorry I copied the name of my module, I meant using GraphQL.Lang.Parser. I needed the functionality because I have to work on a GraphQL proxy that takes a single query and resolves to several GQL instances. I needed to parse the query, and change the AST to only send parts of the query to different instances, at which point I needed to re-stringify the AST.

Its and odd use case I appreciate and in the end I just wrote a simple module to do this, I cant think of any uses you might have for this, feel free to close this down.

Cheers, Chris

@sunny-g
Copy link

sunny-g commented Sep 26, 2017

@chrisjowen do you have this code available anywhere? I think I could use something similar to what you've made for implementing an ACL, implementing a subscriptions module on top of an existing GraphQL server, and split a query among different databases 😄

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

No branches or pull requests

3 participants