protobuf.js icon indicating copy to clipboard operation
protobuf.js copied to clipboard

Wrong resolution of imported message type via root.lookup()

Open 80220 opened this issue 3 years ago • 0 comments

protobuf.js version: master (6254efb1bd9263978e9a90da3b05c4ccbcd6564a)

Problem originates from: https://github.com/JennieJi/protobuf2swagger/issues/19. I wonder if failure in protobuf2swagger is a result of a bug in protobuf.js. proto input is:

tests/data/duplicated_defs/a/b/c/d/common.proto
tests/data/duplicated_defs/a/b/c/d/request.proto
tests/data/duplicated_defs/a/b/common.proto

Both common files contain definition of StaticRoute msg. reqest.proto imports the one from /a/b/c/d/. After conversion of proto files into reflection objects (root), root.lookUp() returns wrong definition from wrong namespace (a/b/ instead of a/b/c/d)

I pushed failing testcase into forked branch: https://github.com/protobufjs/protobuf.js/compare/master...80220:protobuf.js:patch/wrong_resolution

80220 avatar Sep 12 '22 10:09 80220