参数解析增加解析标题
This commit is contained in:
parent
7ddd96bcb7
commit
bd01c39fcc
@ -158,9 +158,14 @@ func (c controller) parseParamConfig(formDataType reflect.Type) []UriParam {
|
||||
if len(validate) == 0 {
|
||||
validate = strings.TrimSpace(structField.Tag.Get(TagNameValidate))
|
||||
}
|
||||
title := strings.TrimSpace(structField.Tag.Get(TagNameDesc))
|
||||
if len(title) == 0 {
|
||||
title = jsonTag
|
||||
}
|
||||
res = append(res, UriParam{
|
||||
Field: structField.Name,
|
||||
Name: jsonTag,
|
||||
Title: title,
|
||||
Type: structField.Type.String(),
|
||||
Validate: validate,
|
||||
ErrorMsg: "",
|
||||
|
@ -53,6 +53,7 @@ type UriConfig struct {
|
||||
type UriParam struct {
|
||||
Field string `json:"field"` // 结构体字段
|
||||
Name string `json:"name"` // 参数名称
|
||||
Title string `json:"title"` // 参数标题
|
||||
Type string `json:"type"` // 参数类型
|
||||
Validate string `json:"validate"` // 验证规则: validator/v10 库
|
||||
ErrorMsg string `json:"error_msg"` // 验证失败的错误信息
|
||||
|
Loading…
x
Reference in New Issue
Block a user