shurcooL / graphql

Package graphql provides a GraphQL client implementation.
MIT License
709 stars 282 forks source link

query with complex arguments are not working #60

Closed carstenmichel closed 4 years ago

carstenmichel commented 4 years ago

Hello and thanks for the work that you already did put into this!

I want to talk to a GraphQL Server. I can only consume it, I have no influence on the API.

My query looks roughly like this:

var query1 struct {
        member struct {
            n1 graphql.Int
            s1 graphql.String
        } `graphql:"parameters: { p1: \"123\", p2: 123}"`
    }

Please see that the query arguments have a struct as parameter.

I can talk fine manually to the server using GraphiQL or Postman. When I use golang with this lib, it fails to parse the list or arguments with: 2020/09/28 16:43:22 Invalid Syntax : offending token '{' at line 1 column 16 Please ignore the exact column number, I abstracted the query Many thanks for looking into this.

carstenmichel commented 4 years ago

Solved it by providing the complete parameters object as variable