-
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
gqlgen v0.17.42 breaks / incompatible with gqlgenc vv0.16.0 #2874
Comments
This issue is affecting me as well. |
same issue here |
Same problem. Need to do something |
If my PR #2878 is merged (and is included in a release, etc), you will be able to specify a new configuration option |
@ghjm I'm testing gqlgen @ |
The client generator has always generated these base models. If you want gqlgenc not to output them, that would require a change in https://github.com/Yamashou/gqlgenc, not here. This PR just (optionally) prevents gqlgen from generating them, so that it doesn't conflict with gqlgenc. |
Also, now that the PR has been merged, this issue can be closed. Cc @StevenACoffman |
@ghjm shouldn't the change of the bool option in the I originally reported this issue when the version of gqlgen I was trying to pull in started behaving in this way, but it seems as though it's always been erroneously generated by |
You must be generating different packages for the client and the server. I was trying to avoid this, because I also use the generated structs for internal data handling, and I didn't want to have two different type systems for client-side and server-side representations of identical objects. So for me it is a problem that gqlgen started generating the empty Query and Mutation structs, because they conflict with the same-named structs generated by gqlgenc. Whatever you're trying to do, it's not the same as what I was trying to do. This PR does solve my problem and I'm now able to upgrade to latest-version gqlgen without problems, as long as I set the configuration flag. |
And maybe this issue shouldn't be closed since it is apparently not solved for @matoszz, who opened the issue. |
@ghjm interesting, appreciate the response / feedback - I may be inadvertently generating different packages for the client and server as your description seems like what i'm trying to accomplish as I also use the generated structs for internal data handling. Would you mind sharing your gqlgen + gqlgenc configuration(s)? It'd be helpful for me to see how you're managing these as a single package in practice. In my gqlgen.yml I have:
and gqlgenc.yml:
is it as simple as making the package names the same and aligning the model file names? |
A new version has been released to allow Query and Mutation to not be generated
https://github.com/Yamashou/gqlgenc/releases/tag/v0.18.0 Please let me know if this release does not solve the problem. |
@matoszz I followed these instructions from @Yamashou: Yamashou/gqlgenc#111. I don't use the gqlgenc CLI, and therefore, I don't use a gqlgenc.conf - instead I use Go code to run a pass of gqlgen that adds gqlgenc as a plugin. You can see an example of this here: https://github.com/ghjm/connectopus/tree/main/pkg/cpctl. |
New version adds autobind functionality to gqlgenc. It is only for models, but if it helps I would be happy. |
@Yamashou but this version still generates the empty structs in the model. |
@onkarbanerjee |
What happened?
When pulling the update for gqlgen v0.17.42, there was an introduction of the creation of empty
Query
andMutation
structs which now conflict with the gqlgenc generated client that contain the same structs; an example diff I'm seeing when pulling in the new version can be seen hereWhat did you expect?
The underlying client generated models shouldn't contain empty Mutation and Query structs
Minimal graphql.schema and models to reproduce
I believe you can reproduce this with any schema, but specifically with the gqlgenc client generation enabled in conjunction with gqlgen. I've forked my underlying repo and generated the diff created by gqlgen / gqlgenc here
versions
go run github.com/99designs/gqlgen version v0.17.42
?go version 1.21.5
?The text was updated successfully, but these errors were encountered: