arthurnn / twirp-ruby

Twirp services in Ruby
Apache License 2.0
155 stars 60 forks source link

Google 'Empty' not generated with a namespace #21

Closed qnm closed 6 years ago

qnm commented 6 years ago

I've got a protobuf which returns an Empty e.g.

syntax = "proto3";
import 'google/protobuf/empty.proto';

service Subscription {
  rpc Subscribe(Subscriptions) returns (google.protobuf.Empty);
}

However, the generated code:

   class SubscriptionService < Twirp::Service
     rpc :Subscribe, Subscriptions, Empty, :ruby_method => :subscribe
   end

Whereas it should be:

   class SubscriptionService < Twirp::Service
     rpc :Subscribe, Subscriptions, Google::Protobuf::Empty, :ruby_method => :subscribe
   end

I'm calling the generator using:

grpc_tools_ruby_protoc --ruby_out=app/rpc --twirp_ruby_out=app/rpc app/proto/*.proto
root@11768bc0a972:/# grpc_tools_ruby_protoc --version
libprotoc 3.5.1

Any ideas what I'm doing wrong?

marioizquierdo commented 6 years ago

Nothing is wrong in your definitions. The code generation simply does not support importing other message types yet. I'll see if I can add support to it.