mirror of
https://github.com/beego/bee.git
synced 2024-11-14 17:00:54 +00:00
add global securitydefinitions to parameters set in router
This commit is contained in:
parent
1a79d6dcca
commit
208c3aa697
@ -184,6 +184,13 @@ func GenerateDocs(curpath string) {
|
||||
rootapi.Schemes = strings.Split(strings.TrimSpace(s[len("@Schemes"):]), ",")
|
||||
} else if strings.HasPrefix(s, "@Host") {
|
||||
rootapi.Host = strings.TrimSpace(s[len("@Host"):])
|
||||
} else if strings.HasPrefix(s, "@SecurityDefinition") {
|
||||
if len(rootapi.SecurityDefinitions) == 0 {
|
||||
rootapi.SecurityDefinitions = make(map[string]swagger.Security)
|
||||
}
|
||||
fullString := strings.TrimSpace(s[len("@SecurityDefinition"):])
|
||||
e := strings.SplitN(fullString, " ", 4)
|
||||
rootapi.SecurityDefinitions[e[0]] = swagger.Security{Type: e[1], Name: e[2], In: e[3]}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user