mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-10 00:29:01 +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 (
|
||||
tags []reflect.StructTag
|
||||
)
|
||||
comment := ""
|
||||
//get required info from gogoproto.moretags
|
||||
moretags := tag.GetMoreTags(field)
|
||||
if moretags != nil {
|
||||
tags = []reflect.StructTag{reflect.StructTag(*moretags)}
|
||||
}
|
||||
validateTag := tag.GetTagValue("validate", tags)
|
||||
if len(validateTag) > 0 {
|
||||
comment = validateTag
|
||||
}
|
||||
re, _ := regexp.Compile("required *,*")
|
||||
comment := re.ReplaceAllString(validateTag, "")
|
||||
return comment
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user