stephenh / ts-proto

An idiomatic protobuf generator for TypeScript
Apache License 2.0
2.14k stars 346 forks source link

Duplicate generated file name #366

Closed upMKuhn closed 2 years ago

upMKuhn commented 3 years ago

Hello,

Thank you for your library! I encountered the following warning when using. http://buf.build

Import within the protobuf file leads to the warning below.

import "google/protobuf/any.proto";
Warning: Duplicate generated file name "google/protobuf/any.ts". Buf will continue without error here and drop the second occurrence of this file, but please raise an issue with the maintainer of the plugin.
mtconseils commented 3 years ago

Adding strategy: all in the ts_proto section of my buf.gen.yaml file fixed the issue for me. See https://docs.buf.build/configuration/v1/buf-gen-yaml/#strategy

stephenh commented 3 years ago

Hey @mtconseils thanks for reporting what worked for you! @upMKuhn if you confirm that this also works for you, a PR to update the readme with a "Buf" section would be great. Thanks!

upMKuhn commented 3 years ago

Hi Stephenh, I'll try it out on the weekend and then I can do a PR to the docs

boukeversteegh commented 2 years ago

Any results on this @upMKuhn ?

nick-lehmann commented 2 years ago

I can confirm that adding strategy: all indeed fixes the problem. See the reference here for what it does.

stephenh commented 2 years ago

Great, thanks @nick-lehmann ! I've added a note about this to the readme.

Actually, could anyone post a super-minimal version of their buf.gen.yaml config that has ts-proto in it? Then we could include that snippet in the readme as well. Thanks!

nick-lehmann commented 2 years ago

Sure, I can give an excerpt from my current buf.gen.yaml:

version: v1
plugins:
  - name: ts
    out: ../gen/ts
    strategy: all
    path: ../node_modules/ts-proto/protoc-gen-ts_proto
stephenh commented 2 years ago

Great, thanks @nick-lehmann ! Added a new Buf section in the readme.

nick-lehmann commented 2 years ago

Thank you @stephenh for the fast response 👍🏻

stephenh commented 2 years ago

:tada: This issue has been resolved in version 1.99.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: