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

Enhanced ValidationCtx method to support nested map in slice #915

Closed
2 tasks done
leftjs opened this issue Mar 19, 2022 · 1 comment · May be fixed by #956
Closed
2 tasks done

Enhanced ValidationCtx method to support nested map in slice #915

leftjs opened this issue Mar 19, 2022 · 1 comment · May be fixed by #956

Comments

@leftjs
Copy link
Contributor

leftjs commented Mar 19, 2022

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

Package version eg. v9, v10:

v10

Issue, Question or Enhancement:

Enhanced ValidationCtx method to support nested map in slice

Currently ValidateCtx cannot support the validation method of nested map in slices, which makes ValidateCtx inconvenient to use. Can it be enhanced?

Code sample, to showcase or reproduce:

test data like this

data: map[string]interface{}{
	"Test_A": map[string]interface{}{
		"Test_B": "Test_B",
		"Test_C": []interface{}{"Test_D"},
		"Test_E": map[string]interface{}{
			"Test_F": "Test_F",
		},
		"Test_G": "Test_G",
		"Test_I": []map[string]interface{}{
			{
				"Test_J": "Test_J",
			},
		},
	},
},
rules: map[string]interface{}{
	"Test_A": map[string]interface{}{
		"Test_B": "min=2",
		"Test_C": map[string]interface{}{
			"Test_D": "min=2",
		},
		"Test_E": map[string]interface{}{
			"Test_F": "min=100",
		},
		"Test_G": map[string]interface{}{
			"Test_H": "min=2",
		},
		"Test_I": map[string]interface{}{
			"Test_J": "min=100",
		},
	},
},
@deankarn
Copy link
Contributor

deankarn commented May 1, 2022

PR #915 merged

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

Successfully merging a pull request may close this issue.

2 participants