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

Fix #2856: resolver receive previous implementation on render #2886

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roneli
Copy link
Contributor

@roneli roneli commented Jan 20, 2024

Fix #2856

When implementing the plugin.ResolverImplementer (for example, to make a CRUD method), the original template initialization code will override that code.

This PR gives the resolver implementor the previous method body, so it will be empty if no previous body was created before.

It does break the interface, but I would assume its a minor inconvenience for anyone who uses this interface to update.

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

@coveralls
Copy link

coveralls commented Jan 20, 2024

Coverage Status

coverage: 75.824% (-0.04%) from 75.865%
when pulling 7adcefe on roneli:feat-gqlgen-2854-resolver
into 5524a39 on 99designs:master.

@roneli
Copy link
Contributor Author

roneli commented Mar 16, 2024

Hi @StevenACoffman,

I would actually find this PR useful for my project if possible for us to merge this also?

I can create a config option that by default that keeps the old version that doesn't "regenerate" after first render which will keep the original intention, and when the flag is on then the resolver will always regenerate + get past generation

WDYT?

@StevenACoffman
Copy link
Collaborator

Sorry for not responding earlier.

I was sort of confused with some of the description of this PR and in the issue, so I've gone back and collected the original issues and changed the description.

Breaking an interface is not ideal, and breaking compatibility with someone's established usage is even worse.

If there was a config option that would be better.

@tsingsun
Copy link

I added a rewriter to solve the interface changed in 17.41. Now I have updated to 17.45, the code generation is the same as before, thank you for your work.

@bagnaram
Copy link

bagnaram commented May 3, 2024

Is there an example of the rewriter? We are experiencing this issue in our codebase with schemeas being overwritten.

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.

ResolverImplementer has a break change that the implementor can't know a field status.
5 participants