Skip to content

Commit

Permalink
Merge pull request #9 from enemis
Browse files Browse the repository at this point in the history
FIX ISSUE-8; Allow add custom messages for rules with params
  • Loading branch information
maktoobgar authored Oct 10, 2023
2 parents a9ef490 + 18aba10 commit e2e0621
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ func (o *generatorS) validator(input interface{}) Validator {
if bindingTags := elementT.Tag.Get("binding"); bindingTags != "" {
splits := strings.Split(bindingTags, ",")
for j := 0; j < len(splits); j++ {
value := elementT.Tag.Get("_" + splits[j])
rule := strings.Split(splits[j], "=")
value := elementT.Tag.Get("_" + rule[0])
if value == "" {
value = elementT.Tag.Get(splits[j])
value = elementT.Tag.Get(rule[0])
}
addSpecificMessage(r, splits[j], value)
addSpecificMessage(r, rule[0], value)
}
}
rules[elementT.Name] = r
Expand Down

0 comments on commit e2e0621

Please sign in to comment.