Skip to content

Commit

Permalink
fix path with : in the middle grpc-ecosystem#3517 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mibo-fdc committed Aug 23, 2023
1 parent 99f3b38 commit 63f0310
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
7 changes: 0 additions & 7 deletions protoc-gen-openapiv2/internal/genopenapi/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,6 @@ pathLoop:
jsonBuffer = ""
}
case '/':
if depth == 0 {
parts = append(parts, buffer)
buffer = ""
// Since the stack was empty when we hit the '/' we are done with this
// section.
continue
}
buffer += string(char)
jsonBuffer += string(char)
case ':':
Expand Down
1 change: 1 addition & 0 deletions protoc-gen-openapiv2/internal/genopenapi/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3918,6 +3918,7 @@ func TestTemplateToOpenAPIPath(t *testing.T) {
{"/{user.name=prefix/*}:customMethod", "/{user.name}:customMethod"},
{"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name}:customMethod"},
{"/{parent=prefix/*}/children:customMethod", "/{parent}/children:customMethod"},
{"/item/search:items/{item_no_query}", "/item/search:items/{item_no_query}"},
}
reg := descriptor.NewRegistry()
reg.SetUseJSONNamesForFields(false)
Expand Down

0 comments on commit 63f0310

Please sign in to comment.