-
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
EntityResolver input type fix #2594
EntityResolver input type fix #2594
Conversation
fixes 99designs#2326 - when using `@entityResolver(multi: true)` the InputType of the entity resolver may be in a different package (usually `model`). The fix is to pull the types.Type of the resolver input, and use templates.CurrentImports.LookupType in order to render it correctly (possibly adding another import)
change testdata/entityresolver/gqlgen.yml to use a dedicated package for the model (as in the default sample yml), and run go generate. before the input type fix, generation fails with errors like - plugin/federation/testdata/entityresolver/generated/federation.go:338:17: undeclared name: MultiHelloByNamesInput plugin/federation/testdata/entityresolver/generated/federation.go:354:21: undeclared name: MultiHelloMultipleRequiresByNamesInput plugin/federation/testdata/entityresolver/generated/federation.go:362:17: undeclared name: MultiHelloMultipleRequiresByNamesInput
Thanks very much! This a nice improvement! |
@StevenACoffman, thank you very much for the super-fast merge! |
I really wanted to look at the differences here and with the in progress #2593 and I was hoping that one of you would provide some test coverage before a new release. |
@StevenACoffman, I don't understand... from what I see, #2593 aims to resolve the same bug as this one, so I guess it's no longer relevant, right? |
First, I try not to release a new version more than once a week unless it's entirely critical. Anyone who wants to can pin their gqlgen to a specific commit prior to that. Second, In my volunteer OSS time in the mornings, I tend to only have enough time to see if new PRs fix legit bugs and pass the existing tests. Comparing competing solutions requires a deeper level of engagement. Drafting a new release also generally waits until I have more than the time to sip a single coffee. I'd like to see if one of the solutions better sets us up to fix some of the other federation issues people have reported such as #2559 |
@StevenACoffman, no problem, we'll wait for the release, sorry if I was being pushy. I'm maintaining a couple of OSS repos myself, so I know how it's like... :) RE #2593, as I wrote, I'm quite sure it's no longer relevant - it solves the exact same issue as this one and can be closed. @jclyons52, can you confirm? RE #2559, it seems to be unrelated to either PR. If I'll have some free time, I'll try to give it a look.
It's not the most elegant solution, but it works... :) |
@erankor Yeah looks like we're solving the same issue! I'll close my PR |
fixes #2326 - when using
@entityResolver(multi: true)
the InputType of the entity resolver may be in a different package (usuallymodel
). The fix is to pull the types.Type of the resolver input, and use templates.CurrentImports.LookupType in order to render it correctly (possibly adding another import)Describe your PR and link to any relevant issues.
I have: