grpc-ecosystem/grpc-gateway
Comments of rpc method gets copied if multiple services are present in a proto file.
オープン
#746 opened on 2018/09/05
bughelp wantedopenapi
Repository metrics
- Stars
- (16,971 個のスター)
- PR merge metrics
- (平均マージ 8d 23h) (30d で 147 merged PRs)
説明
I have a proto file which consists of multiple services. When I generate the swagger json file from it, the comment which are mentioned for the first service gets copied down to the second service in the json file.
Here is the proto file:
syntax = "proto3";
import "google/api/annotations.proto";
service SampleService1{
// Comment 1
rpc Method (Empty) returns (Empty){
option (google.api.http) = {
get : "/api/method1"
};
}
}
service SampleService2{
// Comment 2
rpc Method (Empty) returns (Empty){
option (google.api.http) = {
get : "/api/method2"
};
}
}
message Empty {}
Here is the generated swagger json file:
{
"paths": {
"/api/method1": {
"get": {
"operationId": "Method",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/Empty"
}
},
"404": {
"description": "Not Found",
"schema": {}
}
},
"tags": [
"SampleService1"
],
"summary": "Comment 1"
}
},
"/api/method2": {
"get": {
"operationId": "Method",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/Empty"
}
},
"404": {
"description": "Not Found",
"schema": {}
}
},
"tags": [
"SampleService2"
],
"summary": "Comment 1"
}
}
},
"schemes": [
"http",
"https"
],
"tags": [
{
"name": "SampleService1",
"description": "Description"
},
{
"name": "SampleService2",
"description": "Description"
}
],
"basePath": "/",
"host": "localhost:3000",
"definitions": {
"Empty": {
"type": "object"
}
},
"swagger": "2.0"
}
Can anyone help in fixing this issue ?
I don't want the comments to get copied. The comments should be present as it is in json file for their respective rpc methods under their respective services.