libgraphqlparser icon indicating copy to clipboard operation
libgraphqlparser copied to clipboard

Parsing query with variables

Open Maxim-CE opened this issue 5 years ago • 1 comments

Is it possible to parse the query and use variables outside the actual query? For example, the following query is parsed correctly:

query Hero($episode: Episode, $withFriends: Boolean!) {
  hero(episode: $episode) {
    name
    friends @include(if: $withFriends) {
      name
    }
  }
}

However, I did not found a way to use those variables as part of the parsing process:

{
  "episode": "JEDI",
  "withFriends": false
}

In my understanding, the query has to be modified with those variables (use them as default variables in this query) in order for the string to be successfully parsed with "graphql_parse_string" function.

Thanks.

Maxim-CE avatar Oct 29 '20 13:10 Maxim-CE

same issue, any progress?

Liubasara avatar Mar 07 '24 08:03 Liubasara