arthurnn / arthurnn/twirp-ruby
Namespace not retained when generating rpc calls
- Dominant language
- Ruby
- Stars
- 163
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
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
```ruby
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
```ruby
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?
Contributor guide
Research direction
Start with the provided .proto definition and compare its generated Ruby service output, tracing how the fully qualified RPC request and response types are rendered. Done means the generated rpc declaration retains Package::Actions::Asks::RequestAskSnapshot and Package::Actions::Asks::AskSnapshot so the service file imports successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100