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

support validation of slices of structs #2

Closed
woodsaj opened this issue Sep 9, 2015 · 0 comments
Closed

support validation of slices of structs #2

woodsaj opened this issue Sep 9, 2015 · 0 comments

Comments

@woodsaj
Copy link
Contributor

woodsaj commented Sep 9, 2015

Validation does not currently work for slices of structs.
eg.

type Person struct {
  FirstName string `json:"first_name" binding:"Required"`
  LastName string `json:"last_name" binding:"Required"`
}
type Group struct {
  Name string `json:"name" binding:"Required"`
  People []*Person `json:"people"`
}

sending a payload with the following is currently validated as correct, though it should raise an issue for the missing FirstName

{
  "name": "Group1",
  "people": [
    {"first_name": "anthony", "last_name": "woods"},
    {"first_name": "", "last_name": "invalid"}
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant