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

Multiple file package generation creating duplicate generated files #18

Open
alehechka opened this issue Aug 3, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@alehechka
Copy link
Owner

Through some testing in the buf-tour repo, it was found that when multiple .proto files are used to build up the entirety of a package, it results in a generated <file_prefix>.graphql.go file for each .proto file with the exact same contents within.

It seems that what is happening is that all dependencies are provided to the plugin when generating one of the packages, including remote dependencies and sibling files. This is all well and good for the actual generation because both of the resulting files do have all the needed types/function/queries/mutations that would result if the contents of both were combined into a single .proto file.

The outcome of this ticket has two possibilities:

  • The generation is resolved that only one file is generated
    • The drawback and potential snag is deciding which file to use as the final file name for the single generated file (could be easy, could be difficult, only time will tell).
    • This solution would likely be easier because the entirety of the graphql generation is present in both files, so you'd just need to limit the generation to outputting the one file.
  • Generation is changed to continue generating a respective file for each .proto input with the correct types/functions/queries/mutations housed within the respective named file
    • This is the pattern that the go generator uses
    • This will likely be a tad more difficult because you'll need to determine which things go in which file
    • I kinda prefer this as the outcome due to the result having a respective output file for each input .proto file.
@alehechka alehechka added the bug Something isn't working label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant