-
Notifications
You must be signed in to change notification settings - Fork 184
client.execute(gql, variables)
passes variable_values multiple times
#292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, you have to use |
It's not clear to me from the documentation that it has to be passed by keyword value. IMO if a value has to be passed as a keyword argument then it should be marked as keyword-only. |
In gql 2.x: in client.py, we received all execute arguments only as *args and **kwargs and pass those arguments to the transport So it was possible to set the variable_values argument without using the keyword. In gql 3.x: we had to process the variable_values in the client.py code because we now support serialization of variables for custom scalars. I actually checked if the optional positional arguments *args in client.py was actually used anywhere in our code and can confirm that it is not used in any of our transports (all tests are passing without it) So now we have two options:
OR
@Cito what do you think would be the best approach ? |
I would remove the *args , but leave the *kwargs, and use the same signature for execute() in Client as in SyncClientSession and AsyncClientSession. Then you could still pass variable_values as positional parameter. |
Calling
client.execute(gql, variables)
causes an exception along the lines of:I believe this is because in
Client.execute
the variables get bundled up into*args
, and thenSyncClientSession.execute
passes thevariable_values
parameter both in*args
and explicitly.Passing the variables as a keyword argument like
client.execute(gql, variable_values=variables)
appears to work, though I'm not 100% sure.System info (please complete the following information):
The text was updated successfully, but these errors were encountered: