Fork me on GitHub
#graphql
<
2020-03-11
>
souenzzo16:03:57

(com.walmartlabs.lacinia.parser.query/parse-query "{ id }")
=> [{:type :query, :selections [{:type :field, :field-name :id}]}]
There is a function inside lacinia that turns [{:type :query, :selections [{:type :field, :field-name :id}]}] back to query { id } ?

hlship18:03:28

Why do you need to do that? What is your real problem/requirement?

souenzzo19:03:48

I'm working on tools around #eql and #pathom and using eql ast as "lingua franca". Alread translated GraphQL into eql ast. Now I want to turn eql ast back to GraphQL

hlship19:03:54

You can probably accomplish something with the preview apis, but there isn't a directly supported way of going backwards from a parsed query to the original query.

hlship19:03:12

And the structure of a parsed query is internal, subject to change at any time (thus the need for the preview api).