machinebox / graphql

Simple low-level GraphQL HTTP client for Go
https://blog.machinebox.io/a-graphql-client-library-for-go-5bffd0455878
Apache License 2.0
933 stars 217 forks source link

Trouble deleting [uuid!]! #66

Closed jmillerv closed 3 years ago

jmillerv commented 3 years ago

I'm sending a delete mutation in statement that requires an array of uuids. In graphiql it works to declare the variable and give it

"variable":["uuid1","uuid2"] When I print the req.Vars() to the logs to see what is getting passed, the data works when I copy it into graphiql to test.

I get map[id_array:["18259036-f4f9-298f-7cf5-529977cd0254","d4b1141b-2d82-4b67-e523-6c0d55c8fc5b"]]

However when I use the machinebox client I get the following error graphql: invalid input syntax for type uuid: "["18259036-f4f9-298f-7cf5-529977cd0254","d4b1141b-2d82-4b67-e523-6c0d55c8fc5b"]"

It appears to be wrapping double quotes around the square brackets later in the request process.

jmillerv commented 3 years ago

Looking into the package this is totally a user error. Just pass it a []string as a var and the package will get everything mapped correctly. I was trying too hard to fix it and duplicating some of the efforts of the package which caused issues.