Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes missing swagger operation objects #109

Merged
merged 1 commit into from
Feb 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions examples/examplepb/streamless_everything.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand All @@ -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"
]
}
}
},
Expand Down
5 changes: 4 additions & 1 deletion protoc-gen-swagger/genswagger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()},
Expand Down