set operationId

This commit is contained in:
MaxToby
2021-01-08 22:52:15 +08:00
parent 5dff96f958
commit 9d54da3c67
2 changed files with 13 additions and 31 deletions

View File

@ -109,7 +109,13 @@ func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swagge
},
},
}
operationObject.OperationID = fmt.Sprintf("%s", route.Path)
// get OperationID
for _, annotation := range route.Annotations {
if annotation.Name == "handler" {
operationObject.OperationID = annotation.Value
}
}
for _, param := range operationObject.Parameters {
if param.Schema != nil && param.Schema.Ref != "" {