-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable slices of maps on structs
Right now, the system only allows to use `tags.*` for slices, but if the slice is a complex type(struct or map) there is no way to validate. This commits adds a way to test inside slice content if the value is a map: ``` var data = map[string]interface{}{ "user": "foo", "properties": []map[string]string{{ "phone": "12001", "alias": "foobar", }}, } v := validate.Map(data) v.ConfigRules(map[string]string{ "properties.*.admin": "bool", "properties.*.alias": "minlen:4", }) ``` Added tests inside a current test, I thought that makes sense to have in there. Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
- Loading branch information
Showing
3 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters