Skip to content

Commit

Permalink
fix: remove default service tag generation for methods (#2960)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkolur committed Oct 18, 2022
1 parent 90883f7 commit ed9bb09
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions protoc-gen-openapiv2/internal/genopenapi/template.go
Expand Up @@ -1380,13 +1380,7 @@ func renderServices(services []*descriptor.Service, paths openapiPathsObject, re
responseSchema.Ref = ""
}

tag := svc.GetName()
if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() {
tag = pkg + "." + tag
}

operationObject := &openapiOperationObject{
Tags: []string{tag},
Parameters: parameters,
Responses: openapiResponsesObject{
"200": openapiResponseObject{
Expand All @@ -1396,6 +1390,15 @@ func renderServices(services []*descriptor.Service, paths openapiPathsObject, re
},
},
}

if !reg.GetDisableServiceTags() {
tag := svc.GetName()
if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() {
tag = pkg + "." + tag
}
operationObject.Tags = []string{tag}
}

if !reg.GetDisableDefaultErrors() {
errDef, hasErrDef := fullyQualifiedNameToOpenAPIName(".google.rpc.Status", reg)
if hasErrDef {
Expand Down

0 comments on commit ed9bb09

Please sign in to comment.