timostamm / protobuf-ts

Protobuf and RPC for TypeScript
Apache License 2.0
1.11k stars 131 forks source link

implement CLI option to map proto imports to their module in the project. #495

Open james-lawrence opened 1 year ago

james-lawrence commented 1 year ago

currently imports of other proto files assumes the same relative path. if that assumption doesn't hold there doesn't seem to be a way to remap the path for the dependency.

see related: https://github.com/stephenh/ts-proto/issues/596

yibo-long commented 1 year ago

+1, it will be great for the support.

We manage our protos with different languages with dependencies. For example there is proto NPM package @spanio/a and proto NPM package @spanio/b with b depending on a as:

syntax = "proto3";
package io.span.b;

import "io/span/a/foo.proto";

message Bar {
  io.span.a.Foo foo = 1;
}

some option support like Mio/span/a/foo.proto=@spanio/a will be great! Maybe not prefered by everyone, but Mio/span/a=@spanio/a could make our lives much easier.