mbarbon / google-protobuf-dynamic

Fast and complete Perl protobuf implementation using uPB and Google .proto parser
35 stars 18 forks source link

using import #35

Closed tarkhil closed 11 months ago

tarkhil commented 5 years ago

I cannot make two .proto's to work.

=== Address.proto === package Diadoc.Api.Proto;

message Address { optional RussianAddress RussianAddress = 1; optional ForeignAddress ForeignAddress = 2; optional string AddressCode = 3; }

message RussianAddress { optional string ZipCode = 1;
required string Region = 2;
optional string Territory = 3;
optional string City = 4;
optional string Locality = 5;
optional string Street = 6;
optional string Building = 7; optional string Block = 8;
optional string Apartment = 9; }

message ForeignAddress { required string Country = 1;
required string Address = 2;
} === Address.proto ===

=== Organization.proto === import "Address.proto";

package Diadoc.Api.Proto;

//... message Department { required string DepartmentId = 1; required string ParentDepartmentId = 2; required string Name = 3; optional string Abbreviation = 4; optional string Kpp = 5; optional Address Address = 6; optional bool IsDisabled = 7 [default = false]; } //... === Organization.proto ===

Every attempt I was able to imagine yields an error

Error processing serialized protobuf descriptor: Organization.proto: Import "Address.proto" has not been loaded. Error processing serialized protobuf descriptor: Organization.proto: ".Diadoc.Api.Proto.Address" is not defined.

Looks like either your module does not handle import properly or I'm doing some quite simple error

vphantom commented 4 years ago

Did you ever solve this issue? I'm being bit by it as well.

vphantom commented 4 years ago

Success! For me the following works:

protoc -Iprotobuf --perl-gpd_out=package=...,map_package=...,prefix=...:lib other.proto main.proto

In other words: one must specify all .proto files explicitly to the compiler for their definitions to be included in the generated serialized Perl module.

jjatria commented 12 months ago

This issue seems to be fixed and could now be closed.