mirror of
https://github.com/go-kratos/kratos.git
synced 2025-02-03 13:11:42 +02:00
delete validate 'required' string
This commit is contained in:
parent
f3bb1b1ee0
commit
f18a1b713f
@ -321,15 +321,13 @@ func getValidateComment(field *descriptor.FieldDescriptorProto) string {
|
|||||||
var (
|
var (
|
||||||
tags []reflect.StructTag
|
tags []reflect.StructTag
|
||||||
)
|
)
|
||||||
comment := ""
|
|
||||||
//get required info from gogoproto.moretags
|
//get required info from gogoproto.moretags
|
||||||
moretags := tag.GetMoreTags(field)
|
moretags := tag.GetMoreTags(field)
|
||||||
if moretags != nil {
|
if moretags != nil {
|
||||||
tags = []reflect.StructTag{reflect.StructTag(*moretags)}
|
tags = []reflect.StructTag{reflect.StructTag(*moretags)}
|
||||||
}
|
}
|
||||||
validateTag := tag.GetTagValue("validate", tags)
|
validateTag := tag.GetTagValue("validate", tags)
|
||||||
if len(validateTag) > 0 {
|
re, _ := regexp.Compile("required *,*")
|
||||||
comment = validateTag
|
comment := re.ReplaceAllString(validateTag, "")
|
||||||
}
|
|
||||||
return comment
|
return comment
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user