You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mw.SendMessage(ConnectionId, mwapp.SendMessageInput{
Message: "Hi, Please tell us your name. \n you can write it below",
Form: &mwapp.FormInput{
Key: FormKeyName.String(),
},
})
As you can see above I just use one field Key and ignore the rest. So I expect the default graphql fields specified in schema to be used when send request. But they are sent like null too.
To Reproduce
Create mutation whose input have fields with default fields
Expected behavior
Default fields to be respected when. I believe having pointer with omitempty in the generated code will be the solution. But I don't know how to archive this
Does it work to use genqlient's omitempty option? For example you could add at the top of the file # @genqlient(for: "FormInput.inputType", omitempty: true), and so on for each field. (Obviously that's a bit verbose; we could talk about if there's a better way to do it, perhaps by extending #198 to allow an omitempty option.)
benjaminjkraft
changed the title
Default graphql values are ignored when send request
InputObject field defaults are ignored/overridden
Dec 3, 2022
I get omitempty may only be used on optional arguments error, so in this case, I cannot specifically pick input fields that should respect the server default when empty.
I can, however, put omitempty to all fields by removing the for - without the above error
IMO omitempty:false should be allowed to an input field that has a valid default (that is - it is nullable and it has not explicit default, or it has explicit default).
A bit related to #290 (false positive error on omitempty)
Describe the bug
Hi geeks, Thanks for this amazing lib. I have the following graphql input with default fields
Which I use in golang like
As you can see above I just use one field
Key
and ignore the rest. So I expect the default graphql fields specified in schema to be used when send request. But they are sent like null too.To Reproduce
Create mutation whose input have fields with default fields
Expected behavior
Default fields to be respected when. I believe having pointer with
omitempty
in the generated code will be the solution. But I don't know how to archive thisgenqlient version
v0.5.0
Additional context
My genqclient.yaml is
Any help on fixing this will be appreciated.
The text was updated successfully, but these errors were encountered: