feat: apply separate security requirement object for each route
Signed-off-by: soasurs <soasurs@gmail.com>
This commit is contained in:
parent
10c670eac2
commit
a0743019ac
@ -59,7 +59,7 @@ func applyGenerate(p *plugin.Plugin, host string, basePath string) (*swaggerObje
|
||||
newSecDefValue.In = "header"
|
||||
s.SecurityDefinitions["apiKey"] = newSecDefValue
|
||||
|
||||
s.Security = append(s.Security, swaggerSecurityRequirementObject{"apiKey": []string{}})
|
||||
//s.Security = append(s.Security, swaggerSecurityRequirementObject{"apiKey": []string{}})
|
||||
|
||||
requestResponseRefs := refMap{}
|
||||
renderServiceRoutes(p.Api.Service, p.Api.Service.Groups, s.Paths, requestResponseRefs)
|
||||
@ -233,6 +233,10 @@ func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swagge
|
||||
|
||||
operationObject.Description = strings.ReplaceAll(operationObject.Description, "\"", "")
|
||||
|
||||
if group.Annotation.Properties["jwt"] != "" {
|
||||
operationObject.Security = &[]swaggerSecurityRequirementObject{{"apiKey": []string{}}}
|
||||
}
|
||||
|
||||
switch strings.ToUpper(route.Method) {
|
||||
case http.MethodGet:
|
||||
pathItemObject.Get = operationObject
|
||||
|
Loading…
x
Reference in New Issue
Block a user