diff --git a/generate/parser.go b/generate/parser.go index 359f68b..a82e357 100644 --- a/generate/parser.go +++ b/generate/parser.go @@ -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