Skip to content

Response type not resolved in service methods #497

@subk

Description

@subk

Calling resolve() on a service method properly set resolvedRequestType but resolvedResponseType is always null.

.proto :

syntax = "proto3";

package example1;

message MyRequest {
  string foo = 1;
}
message MyResponse {
  string bar = 1;
}
service MyTestService {
  rpc getTest(MyRequest) returns (MyResponse);
}

.js :

protobuf
  .load(proto)
  .then(root => {
    const service = root.lookup('example1.MyTestService');
    for (let name in service.methods) {
      const method = service.methods[name];
      method.resolve();
      console.log(method.resolvedRequestType instanceof protobuf.Type);
      console.log(method.resolvedResponseType instanceof protobuf.Type);
    }
  });

output :

true
false

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions