Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ paths:
patch:
tags:
- Messaging
operationId: Messaging_UpdateMessage
operationId: Messaging_UpdateMessage_2
requestBody:
content:
application/json:
Expand Down
9 changes: 7 additions & 2 deletions cmd/protoc-gen-openapi/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func (g *OpenAPIv3Generator) addPathsToDocumentV3(d *v3.Document, services []*pr
rules = append(rules, rule.AdditionalBindings...)
}

for _, rule := range rules {
for i, rule := range rules {
var path string
var methodName string
var body string
Expand Down Expand Up @@ -748,10 +748,15 @@ func (g *OpenAPIv3Generator) addPathsToDocumentV3(d *v3.Document, services []*pr
}

if methodName != "" {
opID := operationID
if i > 0 {
// operationId must be unique (OpenAPI v3.0.3 4.7.10.1)
opID = fmt.Sprintf("%s_%d", operationID, i+1)
}
defaultHost := proto.GetExtension(service.Desc.Options(), annotations.E_DefaultHost).(string)

op, path2 := g.buildOperationV3(
d, operationID, service.GoName, comment, defaultHost, path, body, inputMessage, outputMessage)
d, opID, service.GoName, comment, defaultHost, path, body, inputMessage, outputMessage)

// Merge any `Operation` annotations with the current
extOperation := proto.GetExtension(method.Desc.Options(), v3.E_Operation)
Expand Down
Loading