From 9f9d958d6ded084379f80d8739d1c97614e9b2e3 Mon Sep 17 00:00:00 2001 From: "meng.li" Date: Tue, 2 Jul 2019 10:31:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20swagger=20=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84path=EF=BC=8C=E4=BC=9A=E4=B8=A2=E5=A4=B1=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/protobuf/protoc-gen-bswagger/generator.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tool/protobuf/protoc-gen-bswagger/generator.go b/tool/protobuf/protoc-gen-bswagger/generator.go index da606167c..dbba3e0f6 100644 --- a/tool/protobuf/protoc-gen-bswagger/generator.go +++ b/tool/protobuf/protoc-gen-bswagger/generator.go @@ -74,7 +74,9 @@ func (t *swaggerGen) generateSwagger(file *descriptor.FileDescriptorProto) *plug } apiInfo := t.GetHttpInfoCached(file, svc, meth) pathItem := swaggerPathItemObject{} - + if originPathItem,ok := swaggerObj.Paths[apiInfo.Path];ok{ + pathItem= originPathItem + } op := t.getOperationByHTTPMethod(apiInfo.HttpMethod, &pathItem) op.Summary = apiInfo.Title op.Description = apiInfo.Description From 645c10dc35d2bc67112c487ac25d2d79bb0f80a4 Mon Sep 17 00:00:00 2001 From: "meng.li" Date: Wed, 3 Jul 2019 13:54:34 +0800 Subject: [PATCH 2/2] chore: format code --- tool/protobuf/protoc-gen-bswagger/generator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/protobuf/protoc-gen-bswagger/generator.go b/tool/protobuf/protoc-gen-bswagger/generator.go index dbba3e0f6..ec1a9d71b 100644 --- a/tool/protobuf/protoc-gen-bswagger/generator.go +++ b/tool/protobuf/protoc-gen-bswagger/generator.go @@ -74,8 +74,8 @@ func (t *swaggerGen) generateSwagger(file *descriptor.FileDescriptorProto) *plug } apiInfo := t.GetHttpInfoCached(file, svc, meth) pathItem := swaggerPathItemObject{} - if originPathItem,ok := swaggerObj.Paths[apiInfo.Path];ok{ - pathItem= originPathItem + if originPathItem, ok := swaggerObj.Paths[apiInfo.Path]; ok { + pathItem = originPathItem } op := t.getOperationByHTTPMethod(apiInfo.HttpMethod, &pathItem) op.Summary = apiInfo.Title