Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map validation failing with ISO Codes #1354

Open
ltns35 opened this issue Dec 30, 2024 · 1 comment
Open

Map validation failing with ISO Codes #1354

ltns35 opened this issue Dec 30, 2024 · 1 comment

Comments

@ltns35
Copy link

ltns35 commented Dec 30, 2024

  • [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"`
@nodivbyzero
Copy link
Contributor

Could you provide a test case in which your data does not pass the iso3166_1_alpha2 validation?
Similar to

validator/validator_test.go

Lines 12612 to 12614 in 6c3307e

func TestIsIso3166Alpha2Validation(t *testing.T) {
tests := []struct {
value string `validate:"iso3166_1_alpha2"`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants