diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 4c8c8a33cc6..50806ce071a 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -30,6 +30,31 @@ "tags": [ "ABitOfEverythingService" ] + }, + "post": { + "summary": "ABitOfEverythingService.CreateBody", + "operationId": "CreateBody", + "responses": { + "default": { + "description": "Description", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] } }, "/v1/example/a_bit_of_everything/bulk": { @@ -230,6 +255,30 @@ } }, "/v1/example/a_bit_of_everything/{uuid}": { + "get": { + "summary": "ABitOfEverythingService.Lookup", + "operationId": "Lookup", + "responses": { + "default": { + "description": "Description", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string", + "format": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + }, "delete": { "summary": "ABitOfEverythingService.Delete", "operationId": "Delete", @@ -253,6 +302,38 @@ "tags": [ "ABitOfEverythingService" ] + }, + "put": { + "summary": "ABitOfEverythingService.Update", + "operationId": "Update", + "responses": { + "default": { + "description": "Description", + "schema": { + "$ref": "#/definitions/examplepbEmptyMessage" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string", + "format": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] } } }, diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 184d0536947..e987c217ed1 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -411,7 +411,10 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }) } - pathItemObject := swaggerPathItemObject{} + pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template)] + if !ok { + pathItemObject = swaggerPathItemObject{} + } operationObject := &swaggerOperationObject{ Summary: fmt.Sprintf("%s.%s", svc.GetName(), meth.GetName()), Tags: []string{svc.GetName()},