goctl: support custom swagger authentication (#4811)

This commit is contained in:
kesonan
2025-04-27 23:43:37 +08:00
committed by GitHub
parent 98bebbc74f
commit 15ea07aad1
5 changed files with 27 additions and 19 deletions

View File

@@ -61,12 +61,12 @@ func mergePathItem(old, new spec.PathItem) spec.PathItem {
}
func spec2Path(info apiSpec.Info, group apiSpec.Group, route apiSpec.Route) spec.PathItem {
needJwt := hasKey(group.Annotation.Properties, "jwt")
authType := getStringFromKVOrDefault(group.Annotation.Properties, "authType", "")
var security []map[string][]string
if needJwt {
if len(authType) > 0 {
security = []map[string][]string{
{
swaggerSecurityDefinitionBearerAuth: []string{},
authType: []string{},
},
}
}