优化swagger文档生成
This commit is contained in:
16
util/tool.go
16
util/tool.go
@ -31,7 +31,7 @@ func GetParameterDefaultLocation(requestMethod string) string {
|
||||
case http.MethodOptions:
|
||||
fallthrough
|
||||
case http.MethodTrace:
|
||||
return consts.RequestLocationQuery
|
||||
return consts.RequestDataLocationQuery.String()
|
||||
case http.MethodPost:
|
||||
fallthrough
|
||||
case http.MethodPut:
|
||||
@ -39,9 +39,9 @@ func GetParameterDefaultLocation(requestMethod string) string {
|
||||
case http.MethodPatch: // RFC 5789
|
||||
fallthrough
|
||||
case http.MethodDelete:
|
||||
return consts.RequestLocationBody
|
||||
return consts.RequestDataLocationBody.String()
|
||||
}
|
||||
return consts.RequestLocationQuery
|
||||
return consts.RequestDataLocationQuery.String()
|
||||
}
|
||||
|
||||
// GetSwaggerType 基于输入的类型,
|
||||
@ -51,11 +51,11 @@ func GetParameterDefaultLocation(requestMethod string) string {
|
||||
// Date : 12:23 2024/4/22
|
||||
func GetSwaggerType(inputType string) string {
|
||||
convertTable := map[string]string{
|
||||
consts.DataTypeString: "string",
|
||||
consts.DataTypeInt: "integer",
|
||||
consts.DataTypeUint: "integer",
|
||||
consts.DataTypeFloat: "number",
|
||||
consts.DataTypeBool: "boolean",
|
||||
consts.DataTypeString.String(): "string",
|
||||
consts.DataTypeInt.String(): "integer",
|
||||
consts.DataTypeUint.String(): "integer",
|
||||
consts.DataTypeFloat.String(): "number",
|
||||
consts.DataTypeBool.String(): "boolean",
|
||||
}
|
||||
if _, exist := convertTable[inputType]; exist {
|
||||
return convertTable[inputType]
|
||||
|
Reference in New Issue
Block a user