Skip to content

feat: support validation of array values in URL query parameters #287

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

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

almas1992
Copy link
Contributor

close #286

v := validate.New(map[string][]string{
	"date": {"2023-03", "2023-04"},
})

v.StringRule("date", "required|array|len:2")
v.StringRule("date.*", "required|date:2006-01")

if v.Validate() {
	fmt.Println(v.SafeData())
} else {
	fmt.Println(v.Errors)
}

Print:

map[date:[2023-03 2023-04] date.*:[2023-03 2023-04]]

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14032124049

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 96.737%

Totals Coverage Status
Change from base Build 13689661991: 0.003%
Covered Lines: 2935
Relevant Lines: 3034

💛 - Coveralls

@inhere inhere added the enhancement New feature or request label Mar 24, 2025
@inhere inhere merged commit 8f43fe3 into gookit:master Mar 24, 2025
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

无法验证 url.query 中包含数组的情况
3 participants