update common

This commit is contained in:
白茶清欢 2024-12-24 16:59:37 +08:00
parent e044ff3e59
commit 4bae125445
2 changed files with 25 additions and 8 deletions

View File

@ -58,6 +58,16 @@ func GetParamType(docParamType string, formatType string) consts.DataType {
return consts.DataTypeUint
case "string":
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:
return consts.DataTypeMapStrAny
}

View File

@ -36,10 +36,10 @@ type SwaggerPathConfigParameter struct {
In string `json:"in"` // 参数位置
Required bool `json:"required"` // 是否必传
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"` // 引用的数据结构定义
}
@ -79,12 +79,19 @@ type SwaggerDefinition struct {
//
// Date : 17:25 2024/4/19
type SwaggerDefinitionProperty struct {
Description string `json:"description"` // 描述
Type string `json:"type"` // 类型
Items map[string]string `json:"items,omitempty"` // 引用类型中的引用(数组)
AllOf []map[string]string `json:"allOf,omitempty"` // 引用类型中的引用(对象)
XGoName string `json:"x-go-name"` // go字段名称
XGoPackage string `json:"x-go-package"` // go 包路径
Description string `json:"description"` // 描述
Type string `json:"type"` // 类型
Items *SwaggerDefinitionPropertyItem `json:"items,omitempty"` // 引用类型中的引用(数组)
AllOf []map[string]string `json:"allOf,omitempty"` // 引用类型中的引用(对象)
XGoName string `json:"x-go-name"` // 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 文档整体结构定义