Skip to content

Commit

Permalink
fix camelCase path parameter handling in protoc-gen-swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
t-yuki committed Feb 25, 2016
1 parent 0e80e32 commit bda224a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/examplepb/streamless_everything.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
]
}
},
"/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{camel}": {
"/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{camelCase_value}": {
"post": {
"summary": "ABitOfEverythingService.Create",
"operationId": "Create",
Expand Down
2 changes: 1 addition & 1 deletion protoc-gen-swagger/genswagger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func templateToSwaggerPath(path string) string {
// Parts is now an array of segments of the path. Interestingly, since the
// syntax for this subsection CAN be handled by a regexp since it has no
// memory.
re := regexp.MustCompile("{([a-z][a-z0-9_]*).*}")
re := regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_]*).*}")
for index, part := range parts {
parts[index] = re.ReplaceAllString(part, "{$1}")
}
Expand Down

0 comments on commit bda224a

Please sign in to comment.