mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
Fix swagger generation: info block and server tags not included (#5215)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kevwan <1918356+kevwan@users.noreply.github.com>
This commit is contained in:
@@ -18,8 +18,12 @@ func getBoolFromKVOrDefault(properties map[string]string, key string, def bool)
|
||||
}
|
||||
//I think this function and those below should handle error, but they didn't.
|
||||
//Since a default value (def) is provided, any parsing errors will result in the default being returned.
|
||||
str, err := strconv.Unquote(val[0])
|
||||
if err != nil || len(str) == 0 {
|
||||
str := val[0]
|
||||
// Try to unquote if the string is quoted, otherwise use as-is
|
||||
if unquoted, err := strconv.Unquote(str); err == nil {
|
||||
str = unquoted
|
||||
}
|
||||
if len(str) == 0 {
|
||||
return def
|
||||
}
|
||||
res, _ := strconv.ParseBool(str)
|
||||
@@ -35,8 +39,12 @@ func getStringFromKVOrDefault(properties map[string]string, key string, def stri
|
||||
if len(val) == 0 {
|
||||
return def
|
||||
}
|
||||
str, err := strconv.Unquote(val[0])
|
||||
if err != nil || len(str) == 0 {
|
||||
str := val[0]
|
||||
// Try to unquote if the string is quoted, otherwise use as-is
|
||||
if unquoted, err := strconv.Unquote(str); err == nil {
|
||||
str = unquoted
|
||||
}
|
||||
if len(str) == 0 {
|
||||
return def
|
||||
}
|
||||
return str
|
||||
@@ -52,8 +60,12 @@ func getListFromInfoOrDefault(properties map[string]string, key string, def []st
|
||||
return def
|
||||
}
|
||||
|
||||
str, err := strconv.Unquote(val[0])
|
||||
if err != nil || len(str) == 0 {
|
||||
str := val[0]
|
||||
// Try to unquote if the string is quoted, otherwise use as-is
|
||||
if unquoted, err := strconv.Unquote(str); err == nil {
|
||||
str = unquoted
|
||||
}
|
||||
if len(str) == 0 {
|
||||
return def
|
||||
}
|
||||
resp := util.FieldsAndTrimSpace(str, commaRune)
|
||||
|
||||
Reference in New Issue
Block a user