-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Mutation with variables not working #85
Comments
Your query is using $app, but your passing on appID as the variable Try |
I wonder if adding an error for unused variables would break people's code. |
I dont think throwing an error for unused variables here is the way to go, unless its part of the graphql spec. This is more like user error. |
I don't see anything in the spec, but maybe it should be. There is a bit of chatter in graphql/graphql-spec#235 regarding input field properties which is pretty close. Variables don't have the same issues regarding removing fields. Either way it would probably need to be gated behind a strict mode flag. |
It works, thank you! I had to expand the uint32 unmarshaler because in interface{} ints are float64 but it works! |
Expected Behaviour
I would expect the following mutation to be working:
This is the body of the JSON mutation sent to gqlgen.
Unfortunately the actual "model" in the resolver has that field empty.
If the mutation is sent as:
then it works.
I debugged a bit and I noticed that in the first case the variables are in the context of the mutation:
this prints all the variables I sent using the client but the actual model struct is empty. With the second method there are no variables and the model struct is filled with the values.
Am I doing something wrong?
Actual Behavior
I would expect the mutation to receive the struct filled with the variables sent on the wire. In the meantime I'm filling the model struct manually from the request context.
Minimal graphql.schema and models to reproduce
and the model:
The text was updated successfully, but these errors were encountered: