Skip to content
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

Make gqlgen StructFieldsAlwaysPointers configurable #216

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

mlaflamm
Copy link
Contributor

@mlaflamm mlaflamm commented Apr 17, 2024

When updating to a more recent version of gqlgenc, we encountered issues with the generation of models for non-null fields. Non-null structs fields are always pointers instead of being defined as values. We were impacted by the following two changes:

  • Match gqlgen default settings: Match gqlgen default settings #202
  • struct type field for fragment is pointer: 2bb5b94. This one is quite old, but that change was in only done in client v2, and we were still using client v1.

This PR is to make the generation of non-null structs fields as pointers configurable.

I've used the same name used by gqlgen for the similar config: struct_fields_always_pointers. Unfortunately, that name doesn't fit well with other settings like clientInterfaceName and omitEmptyTypes. Do you prefer a different name? Perhaps structFieldsAlwaysPointers?

@mlaflamm mlaflamm changed the title Make gqngen StructFieldsAlwaysPointers configurable Make gqlgen StructFieldsAlwaysPointers configurable Apr 17, 2024
@Yamashou
Copy link
Owner

@mlaflamm Thanks! Let's name it structFieldsAlwaysPointers!

@Yamashou Yamashou merged commit 29b2a05 into Yamashou:master Apr 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants