twirp-ruby icon indicating copy to clipboard operation
twirp-ruby copied to clipboard

Missing module name in _twirp generated code

Open Ziaw opened this issue 5 years ago • 2 comments

When I generate code from two proto files

// data.proto
syntax = "proto3";
import "ok.proto";

service Data {
    rpc create(SetDataRequest) returns (ok.Response);
}

message SetDataRequest {
    string uuid = 1;
}
// ok.proto
syntax = "proto3";
package ok;

message Response { }

With one protoc execute

protoc --proto_path=. --ruby_out=. --twirp_ruby_out=. --plugin=/Users/a.zimin/go/bin/protoc-gen-twirp_ruby data.proto ok.proto

I have a code with a missing module name of Response class

# data_twirp.rb
# Code generated by protoc-gen-twirp_ruby 1.4.1, DO NOT EDIT.
# ...SKIP...
  rpc :create, SetDataRequest, Response, :ruby_method => :create
# ...SKIP...
module Ok
  Response = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("ok.Response").msgclass
end

With two protoc calls

protoc --proto_path=. --ruby_out=. --twirp_ruby_out=. --plugin=/Users/a.zimin/go/bin/protoc-gen-twirp_ruby data.proto
protoc --proto_path=. --ruby_out=. --twirp_ruby_out=. --plugin=/Users/a.zimin/go/bin/protoc-gen-twirp_ruby ok.proto

Generated code is correct

# data_twirp.rb
# ...SKIP...
  rpc :create, SetDataRequest, Ok::Response, :ruby_method => :create
# ...SKIP...

Ziaw avatar Jan 28 '20 09:01 Ziaw

Is this still a problem on latest version? would you mind double checking? 🙏

arthurnn avatar Jan 05 '23 13:01 arthurnn