validator icon indicating copy to clipboard operation
validator copied to clipboard

"Or" operator: err.Tag() contain all tag around "|"

Open MrSwed opened this issue 1 year ago • 0 comments

  • [x] I have looked at the documentation here first?
  • [x] I have looked at the examples provided that may showcase my question here?

Package version eg. v9, v10:

v10

Issue, Question or Enhancement:

when I use Or Operator ,
err.Tag() contain all tag around |

Code sample, to showcase or reproduce:

type someStruct struct {
//... 
	SortOrder   *int              `json:"sortOrder" db:"sort_order"  validate:"omitempty,gte=10|lte=-1"`
//...
}

 err := Validator.Struct(form)
// err.Tag() = "gte=10|lte=-1"

Expected only one tag, which trigger error

also err.Param() contain alwais last value regardless order of tag

MrSwed avatar Nov 24 '22 14:11 MrSwed