mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
fix: goctl swagger missing security definition and submit json body data error (#4808)
This commit is contained in:
@@ -61,6 +61,15 @@ 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")
|
||||
var security []map[string][]string
|
||||
if needJwt {
|
||||
security = []map[string][]string{
|
||||
{
|
||||
swaggerSecurityDefinitionBearerAuth: []string{},
|
||||
},
|
||||
}
|
||||
}
|
||||
op := &spec.Operation{
|
||||
OperationProps: spec.OperationProps{
|
||||
Description: getStringFromKVOrDefault(route.AtDoc.Properties, "description", ""),
|
||||
@@ -72,6 +81,7 @@ func spec2Path(info apiSpec.Info, group apiSpec.Group, route apiSpec.Route) spec
|
||||
Deprecated: getBoolFromKVOrDefault(route.AtDoc.Properties, "deprecated", false),
|
||||
Parameters: parametersFromType(route.Method, route.RequestType),
|
||||
Responses: jsonResponseFromType(info, route.ResponseType),
|
||||
Security: security,
|
||||
},
|
||||
}
|
||||
externalDocsDescription := getStringFromKVOrDefault(route.AtDoc.Properties, "externalDocsDescription", "")
|
||||
|
||||
Reference in New Issue
Block a user