From 0ea7968ee23068ef22500e8e04ef9650cd9462ff Mon Sep 17 00:00:00 2001 From: Karsten Weiss Date: Sun, 10 Sep 2017 15:46:04 +0200 Subject: [PATCH] service.proto: Add rpc and message comments These comments will show up as godoc comments in the generated service stubs and in the swagger-ui API descriptions. --- echopb/service.pb.go | 3 +++ echopb/service.pb.gw.go | 3 +-- echopb/service.proto | 4 +++- echopb/service.swagger.json | 4 +++- echopb/swagger.pb.go | 4 +++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/echopb/service.pb.go b/echopb/service.pb.go index 669c0d9..79dff49 100644 --- a/echopb/service.pb.go +++ b/echopb/service.pb.go @@ -33,6 +33,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +// EchoMessage is the message text of an Echo() request and response. type EchoMessage struct { Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` } @@ -64,6 +65,7 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for EchoService service type EchoServiceClient interface { + // Echo returns the received message back to the caller. Echo(ctx context.Context, in *EchoMessage, opts ...grpc.CallOption) (*EchoMessage, error) } @@ -87,6 +89,7 @@ func (c *echoServiceClient) Echo(ctx context.Context, in *EchoMessage, opts ...g // Server API for EchoService service type EchoServiceServer interface { + // Echo returns the received message back to the caller. Echo(context.Context, *EchoMessage) (*EchoMessage, error) } diff --git a/echopb/service.pb.gw.go b/echopb/service.pb.gw.go index 3c8598e..15028f6 100644 --- a/echopb/service.pb.gw.go +++ b/echopb/service.pb.gw.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-grpc-gateway +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: service.proto -// DO NOT EDIT! /* Package echopb is a reverse proxy. diff --git a/echopb/service.proto b/echopb/service.proto index e243f4c..a6706ad 100644 --- a/echopb/service.proto +++ b/echopb/service.proto @@ -3,12 +3,14 @@ package echopb; import "google/api/annotations.proto"; +// EchoMessage is the message text of an Echo() request and response. message EchoMessage { string value = 1; } service EchoService { - rpc Echo(EchoMessage) returns (EchoMessage) { + // Echo returns the received message back to the caller. + rpc Echo(EchoMessage) returns (EchoMessage) { option (google.api.http) = { post: "/v1/echo" body: "*" diff --git a/echopb/service.swagger.json b/echopb/service.swagger.json index 277606a..46f1221 100644 --- a/echopb/service.swagger.json +++ b/echopb/service.swagger.json @@ -17,6 +17,7 @@ "paths": { "/v1/echo": { "post": { + "summary": "Echo returns the received message back to the caller.", "operationId": "Echo", "responses": { "200": { @@ -49,7 +50,8 @@ "value": { "type": "string" } - } + }, + "description": "EchoMessage is the message text of an Echo() request and response." } } } diff --git a/echopb/swagger.pb.go b/echopb/swagger.pb.go index ad0a0fd..f196005 100644 --- a/echopb/swagger.pb.go +++ b/echopb/swagger.pb.go @@ -20,6 +20,7 @@ swagger = `{ "paths": { "/v1/echo": { "post": { + "summary": "Echo returns the received message back to the caller.", "operationId": "Echo", "responses": { "200": { @@ -52,7 +53,8 @@ swagger = `{ "value": { "type": "string" } - } + }, + "description": "EchoMessage is the message text of an Echo() request and response." } } }