Replies: 1 comment
-
See #3243 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What happened?
I wanted to use the
rewrite
for single-file mode and made direct changes togenerateSingleFile
. I made changes in very similar fashion togeneratePerSchema
so it behaved similarly in terms of rewriting the file. However, when I rungo generate
at the root of gqlgen folder. One of the folder insider_examples
broke, specificallytype-system-extension
.What did you expect?
I understand that the current
generateSingleFile
does not support rewriting in single-file mode. Still, I want to integrateresolvergen
to a build system that cannot work withgeneratePerSchema
but maintaining the rewrite function is important for large schema changes.Potential Solution
Can we add a new flag
enable_rewrite_for_single_file
and build on top of that? By doing so, we will not break any build from the_examples
while allowing for some flexibility in using single-file. The default for this flag is false but we can use it by adding to our config file:Potential Implementation
codegen/config/resolver.go
EnableRewriteForSingleFile
insideResolverConfig
struct.plugin/resolvergen/resolver.go
generateSingleFileEnableRewrite
function with similar rewrite behaviors togeneratePerSchema
GenerateCode
// THIS CODE WILL BE UPDATED WITH SCHEMA CHANGES. PREVIOUS IMPLEMENTATION FOR SCHEMA CHANGES WILL BE KEPT IN THE COMMENT SECTION. IMPLEMENTATION FOR UNCHANGED SCHEMA WILL BE KEPT.
testdata
to cover the new functionGenerateSingleFileEnableRewrite
.Would appreciate any input! 💡 Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions