update common
This commit is contained in:
parent
e044ff3e59
commit
4bae125445
10
common.go
10
common.go
@ -58,6 +58,16 @@ func GetParamType(docParamType string, formatType string) consts.DataType {
|
|||||||
return consts.DataTypeUint
|
return consts.DataTypeUint
|
||||||
case "string":
|
case "string":
|
||||||
return consts.DataTypeString
|
return consts.DataTypeString
|
||||||
|
case "object":
|
||||||
|
return consts.DataTypeMapStrAny
|
||||||
|
case "array":
|
||||||
|
if formatType == "integer" {
|
||||||
|
return consts.DataTypeSliceInt
|
||||||
|
} else if formatType == "string" {
|
||||||
|
return consts.DataTypeSliceString
|
||||||
|
} else {
|
||||||
|
return consts.DataTypeSliceAny
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return consts.DataTypeMapStrAny
|
return consts.DataTypeMapStrAny
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,10 @@ type SwaggerPathConfigParameter struct {
|
|||||||
In string `json:"in"` // 参数位置
|
In string `json:"in"` // 参数位置
|
||||||
Required bool `json:"required"` // 是否必传
|
Required bool `json:"required"` // 是否必传
|
||||||
EnumList []any `json:"enum_list,omitempty"` // 枚举值列表
|
EnumList []any `json:"enum_list,omitempty"` // 枚举值列表
|
||||||
Schema *SwaggerPathConfigParameterScheme `json:"schema"` // 参数schema
|
Schema *SwaggerPathConfigParameterSchema `json:"schema"` // 参数schema
|
||||||
}
|
}
|
||||||
|
|
||||||
type SwaggerPathConfigParameterScheme struct {
|
type SwaggerPathConfigParameterSchema struct {
|
||||||
Ref string `json:"$ref"` // 引用的数据结构定义
|
Ref string `json:"$ref"` // 引用的数据结构定义
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,12 +81,19 @@ type SwaggerDefinition struct {
|
|||||||
type SwaggerDefinitionProperty struct {
|
type SwaggerDefinitionProperty struct {
|
||||||
Description string `json:"description"` // 描述
|
Description string `json:"description"` // 描述
|
||||||
Type string `json:"type"` // 类型
|
Type string `json:"type"` // 类型
|
||||||
Items map[string]string `json:"items,omitempty"` // 引用类型中的引用(数组)
|
Items *SwaggerDefinitionPropertyItem `json:"items,omitempty"` // 引用类型中的引用(数组)
|
||||||
AllOf []map[string]string `json:"allOf,omitempty"` // 引用类型中的引用(对象)
|
AllOf []map[string]string `json:"allOf,omitempty"` // 引用类型中的引用(对象)
|
||||||
XGoName string `json:"x-go-name"` // go字段名称
|
XGoName string `json:"x-go-name"` // go字段名称
|
||||||
XGoPackage string `json:"x-go-package"` // go 包路径
|
XGoPackage string `json:"x-go-package"` // go 包路径
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SwaggerDefinitionPropertyItem 属性item兴义
|
||||||
|
type SwaggerDefinitionPropertyItem struct {
|
||||||
|
Type string `json:"type"` // 类型
|
||||||
|
Ref string `json:"$ref"` // 引用
|
||||||
|
Enum []any `json:"enum"` // 枚举值
|
||||||
|
}
|
||||||
|
|
||||||
// Swagger 文档整体结构定义
|
// Swagger 文档整体结构定义
|
||||||
//
|
//
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user