delete validate 'required' string

pull/517/head
wuxingzhong 5 years ago
parent f3bb1b1ee0
commit f18a1b713f
  1. 6
      tool/protobuf/protoc-gen-bswagger/generator.go

@ -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…
Cancel
Save