Closed dharijanto closed 7 months ago
Created for this: https://github.com/Khan/genqlient/issues/260
This would be super awesome. The GraphQL server I'm interacting with has deeply nested inputs and without this feature it breaks.
Seems like use_struct_references: false
and optional: pointer
in the yaml might improve my issue. Lots of types need to be updated, so code is getting messy, but maybe later I can see how to clean this up.
Closing in favor of #308 which uses a config option
When
optional: "pointer"
is configured,omitempty
is needed for input fields for the generated code to be semantically correct. Withoutomitempty
an empty pointer would generate an "empty value" which is incorrect.Consider the following graphql schema generated by Hasura:
Without this fix, the following golang struct will be generated:
When we populate the struct without
Id
being set, it'd serialize to{ id: 0 }
as oppose to{}
(i.e. so that the id would be generated by Hasura)I have: