validator icon indicating copy to clipboard operation
validator copied to clipboard

Map validation failing with ISO Codes

Open ltns35 opened this issue 11 months ago • 1 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. v10: v10.23.0

Question:

How can I validate the following map[string]string? It's failing me always with the ISO code but everything is correct.

Code sample, to showcase or reproduce:

Translations map[string]string `validate:"min=1,dive,keys,iso3166_1_alpha2,endkeys,required"`

ltns35 avatar Dec 30 '24 18:12 ltns35

Could you provide a test case in which your data does not pass the iso3166_1_alpha2 validation? Similar to https://github.com/go-playground/validator/blob/6c3307e6c64040ebc0efffe9366927c68146ffba/validator_test.go#L12612-L12614

nodivbyzero avatar Dec 31 '24 01:12 nodivbyzero