question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for service / rpc options

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently, the protobuf plug-in doesn’t appear to understand options defined on either the service level or rpc (method) level.

Describe the solution you’d like The protobuf v3 spec allows for options defined at the service and rpc (method) level.

Additional context Example (using Google’s http.proto): https://github.com/googleapis/googleapis/blob/2a57c3158a97597941220e64a940760d6a738a69/google/api/http.proto#L129-L136

When using the plug-in today, I get various errors when using service or rpc options:

  • When using a built-in option, I get an error regarding an unresolved reference (this reference should be found in the descriptor.proto file):
service MyService {
    option idempotency_level = NO_SIDE_EFFECTS;
    ...
}
  • When using a custom option, I get an error regarding extraneous input (after the semicolon in the option):
service MyService
    option (company.grpc.custom_rule) = {
        my_field: "abc"; // Error after semicolon here
        my_list_field: ["a", "b", "c"];
    };
    ...
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:18

github_iconTop GitHub Comments

3reactions
frennkiecommented, Jul 20, 2019

you need to add a “Custom Include Path” to the Protobuf plugin config

I wasn’t aware of this… thanks.

Still I have same problem that I get an error on the semi-colon (after "go-ws-api";) and on the next line on the first word (version). The files compile without any issue.

syntax = "proto3";
package echopb;

import "google/api/annotations.proto";
import "protoc-gen-swagger/options/annotations.proto";

option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
    info: {
        title: "go-ws-api";
        version: "1.0";
        contact: {
            name: "go-ws-api";
            url: "https://github.com/mch1307/ws-go-api";
            email: "none@example.com";
        };
    };
    schemes: HTTP;
    schemes: HTTPS;
    consumes: "application/json";
    produces: "application/json";
};

message EchoMessage {
 string value = 1;
}

service EchoService {
  rpc Echo(EchoMessage) returns (EchoMessage) {
    option (google.api.http) = {
      post: "/v1/echo"
      body: "*"
    };
  }
}

Code mostly take from: https://blog.csnet.me/blog/building-a-go-api-grpc-rest-and-openapi-swagger.1/

It would be great if this could be fixed in the plugin! 😄

1reaction
ping-localhostcommented, Sep 12, 2019

I’ve just hit this wall as well and it’s really bugs me, since I have a valid file without any syntax highlighting because it’s considered invalid. 😢

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for service / rpc options · Issue #110
When using a built-in option, I get an error regarding an unresolved reference (this reference should be found in the descriptor.proto file):.
Read more >
Configuring a gRPC service - Cloud Endpoints
To create a gRPC service—whether or not you are using Cloud Endpoints—you specify the interface definition in one or more proto files, which...
Read more >
About RPC configuration options - TechDocs - Broadcom Inc.
Protocol-specific options for RPC describes the configuration options for RPC. A single Symantec Protection Engine can support multiple RPC ...
Read more >
service.h | Protocol Buffers
The primary purpose of the controller is to provide a way to manipulate settings specific to the RPC implementation and to find out...
Read more >
gRPC
gRPC is a modern open source high performance Remote Procedure Call (RPC) framework that can run in any environment. It can efficiently connect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found