validator
validator copied to clipboard
en translation issue: "must contain at maximum X items"
- [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
github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.19.0
Issue, Question or Enhancement:
The default en translations for max
have a strange construct (possibly a typo) for slices.
Expected:
{0} must contain maximum {1} items
Actual:
{0} must contain at maximum {1} items
Possibly this is attempting {0} must contain a maximum {1} items
or {0} must contain at most {1} items
. Not sure what the intent is, but the actual isn't right..
Code sample, to showcase or reproduce:
type Example struct {
URIs []string `json:"uris" validate:"required,max=5,dive,uri"
}
Hook up the default en translations and you'll get URIs must contain at maximum 5 items
Since the equivalent with min
resolves to {0} must contain at least {1} items
, I'm pretty sure the intent here was to have {0} must contain at most {1} items
as its max counterpart.