Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBJ does not handle package directive correctly #262

Open
jsync-swirlds opened this issue Jun 5, 2024 · 0 comments
Open

PBJ does not handle package directive correctly #262

jsync-swirlds opened this issue Jun 5, 2024 · 0 comments

Comments

@jsync-swirlds
Copy link
Member

PBJ does not handle the package directive correctly when another message refers to a message defined in a file with a package directive.
The package directive, in protoc, is treated as a C++ namespace, rather than a Java package, and common prefixes are elided when matching between the current file and a search space. The PBJ compiler, however, treats it as a Java package and requires a full-text match. This causes MANY third-party proto files (some of which we may wish to use, such as validation plugins) to fail compilation for PBJ.

Example

parent_item.proto file:

syntax = "proto3"

package one.package.name;

import "children/child_item.proto";

message Item {
  repeated child.ChildItem children = 1;
}

children/child_item.proto

syntax = "proto3"

package one.package.name.child;

message ChildItem {
  uint32 a_value = 1;
}

The canonical protoc compiler handles these correctly and compiles as expected.
PBJ fails with an error message similar to this:

Not found pbj package for message or enum [child.ChildItem] in file [test-protobufs/one/package/name/parent_item.proto]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant