I'm designing some protobuf
schemas for a project, what I want is to have independent packages, and a shared package. please see the example below.
// file: shared.proto
syntax = "proto3";
package package.shared;
message Address {
string line = 1;
string city = 2;
string state = 3;
string country = 4;
uint32 zip = 5;
}
// file: invoice.proto
syntax = "proto3";
package package.invoice;
import "./shared.proto";
message Invoice {
// some fields
shared.Address address = 1;
}
// file: customer.proto
syntax = "proto3";
package package.customer;
import "./shared.proto";
message Customer {
// some fields
shared.Address address = 1;
}
I tried the above approach to design what I needed however, it's not working, getting the error Import Error: ./shared.proto is not found or has some error
Right now, I'm duplicating the shared fields with Invoice and Customer as a work around, I will be generating these protobuf
's for TypeScript and Java once complete.
If anyone knows a proper solution, please answer.
Note: This question is not a duplicate question, I tried to find import and shared package-related documents or answers, but still no luck.
Thanks