Closed
Description
- Same issue already reported and closed: Merging swagger specs fails to use rpc comments #664
- Clean installed github.com/grpc-ecosystem/grpc-gateway v1.14.5
Steps:
Generate stubs like so (for protos/yaml defined further below):
common="-I/usr/local/include -I${GOPATH}/pkg/mod/ -Isample -I${GOPATH}/src"
spec=sample/services.yaml
gwopt="logtostderr=true,allow_delete_body=true,grpc_api_configuration=${spec}"
swopt="${gwopt},json_names_for_fields=true,allow_merge=true"
protoc $common --plugin=$GOPATH/bin/protoc-gen-go \
--go_out=plugins=grpc:$GOPATH/src sample/*.proto
protoc $common --plugin=$GOPATH/bin/protoc-gen-grpc-gateway \
--grpc-gateway_out=${gwopt}:$GOPATH/src sample/*.proto
protoc $common --plugin=$GOPATH/bin/protoc-gen-swagger \
--swagger_out=${swopt}:sample/ sample/*.proto
sample/a.proto
syntax = "proto3";
package sample;
import "google/protobuf/empty.proto";
// Message A
message MsgA {
// Success or error code
int32 code = 1;
// Descriptive success or error message
string message = 2;
}
// Service for Message A
service MsgAService {
// RPC for getting Message A
rpc GetMsgA (google.protobuf.Empty) returns (MsgA) {}
}
sample/b.proto
syntax = "proto3";
package sample;
import "google/protobuf/empty.proto";
// Message B
message MsgB {
// Success or error code
int32 code = 1;
// Descriptive success or error message
string message = 2;
}
// Service for Message B
service MsgBService {
// RPC for getting Message B
rpc GetMsgB (google.protobuf.Empty) returns (MsgB) {}
}
sample/services.yaml
type: google.api.Service
config_version: 3
http:
rules:
- selector: sample.MsgAService.GetMsgA
get: /api/msga
- selector: sample.MsgBService.GetMsgB
get: /api/msgb
Issue:
summary
key is missing for /api/msgb in following portion of the generated spec.
"paths": {
"/api/msga": {
"get": {
"summary": "RPC for getting Message A",
"operationId": "MsgAService_GetMsgA",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/sampleMsgA"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"tags": [
"MsgAService"
]
}
},
"/api/msgb": {
"get": {
"operationId": "MsgBService_GetMsgB",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/sampleMsgB"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"tags": [
"MsgBService"
]
}
}
}
Metadata
Metadata
Assignees
Labels
No labels