twirp-ruby
twirp-ruby copied to clipboard
Namespace not retained when generating rpc calls
Please consider the following .proto file:
package package.rpc.asks;
import "package/actions/asks.proto";
service Ask {
rpc GetAskSnapshot(package.actions.asks.RequestAskSnapshot) returns (package.actions.asks.AskSnapshot) { }
}
I would expect this to generate a Ruby file
module Package
module Rpc
module Asks
class AskService < Twirp::Service
package 'superlist.rpc.asks'
service 'Ask'
rpc :GetAskSnapshot, Package::Actions::Asks::RequestAskSnapshot, Package::Actions::Asks::AskSnapshot, :ruby_method => :get_ask_snapshot
end
however, it drops the package name for the parameter and generates
module Package
module Rpc
module Asks
class AskService < Twirp::Service
package 'superlist.rpc.asks'
service 'Ask'
rpc :GetAskSnapshot, RequestAskSnapshot, AskSnapshot, :ruby_method => :get_ask_snapshot
end
which results in an error when trying to import the service file. The RequestAskSnapshot is expected as Package::Rpc::Asks::AskService::RequestAskSnapshot which doesn't exists (as it's supposed to be Package::Actions::Asks::RequestAskSnapshot).
Am I missing something?
Hi, yes this appears to be a bug. Right now the only workaround for this is to manually edit the generated file.