google / gnostic

A compiler for APIs described by the OpenAPI Specification with plugins for code generation and other API support tasks.
Apache License 2.0
2.03k stars 241 forks source link

Default to gRPC path if no mapping is provided #429

Open Kryan90 opened 4 months ago

Kryan90 commented 4 months ago

I am using protoc-gen-openapi to generate api docs. The project is being built using connectrpc which uses GRPC_SERVICE_FULL_NAME/METHOD_NAME for paths.

We are currently adding this manually for each method, ie.

service MyService {
  rpc Foo(FooRequest) returns (FooResponse) {
    option (google.api.http) = {
      post: "/my.package.v1.MyService/Foo"
      body: "*"
    };
  }
}

Is there an existing way to use the GRPC_SERVICE_FULL_NAME/METHOD_NAME as a default? If not is that something you would consider adding? There is some precedence for this usage in Cloud Endpoints transcoding https://cloud.google.com/endpoints/docs/grpc/transcoding#where_to_configure_transcoding