-
Notifications
You must be signed in to change notification settings - Fork 114
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
None type passed instead of Empty Array #193
Comments
Ah, interesting, thanks for raising this. The workaround, if it isn't clear, is to use The question is, should genqlient do that for you, should it complain explicitly, or should it just pass through to the server (the current behavior). Thinking out loud, I have to admit I don't like any of the options: doing it automatically seems a bit too magical as you did after all pass A perhaps interesting question here is: what do servers do? I didn't check but I assume Apollo will validate for this, because it's very good about that. But gqlgen, contra the spec, does not; it treats The last thing is that I worry a little that this will be annoying to implement; I think it would require we write an unmarshaler method for all non-nullable types which are represented by nullable types in Go (which includes all non-nullable lists and objects, at least). That's not a dealbreaker but I don't feel great about it. We could revisit if/when we do #47, which would make it much easier. So on the whole I think I'm inclined to say this is working as intended: you've passed an invalid value which is (unfortunately but necessarily) a member of the Go type we must use, and we leave it to the server to explicitly reject that (or not!). I'm open to further discussion though, or comments from anyone else who has been hit by this! So I'll leave it open for a bit for that. |
Thanks for such a prompt and detailed response! I'm inclined to agree with you, as long as this is documented, and now with your response in this ticket then it is, then I think the current behavior is reasonable. |
Apologies if this is user error, but I cannot find anything relating to this in the docs or existing issues.
With a schema:
bar should never be a null type, but always passed as an empty list.
Using the query generated from:
and:
We are instead getting
{"bar": null }
We should instead get
{"bar": [] }
This happens at runtime.
genqlient version
v0.3.1-0.20220113190133-9fbb6b87aa40
The text was updated successfully, but these errors were encountered: