Skip to content

Multiple file package generation creating duplicate generated files #18

Description

@alehechka

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions