Skip to content

fix: ValidateMapCtx support for more baked-in validators#958

Open
echovl wants to merge 1 commit intogo-playground:masterfrom
echovl:fix/validate-map
Open

fix: ValidateMapCtx support for more baked-in validators#958
echovl wants to merge 1 commit intogo-playground:masterfrom
echovl:fix/validate-map

Conversation

@echovl
Copy link
Copy Markdown
Contributor

@echovl echovl commented Jun 4, 2022

Fixes Or Enhances

Fixes #893.
Fixes #943.

Specifying other keys of the map requires brackets.

Example:

v := validator.New()

data := map[string]interface{}{
    "foo": "bar",
    "foo2": "",
}
rules := map[string]interface{}{
    "foo": "required_without=[foo2]",
}

res := v.ValidateMap(data, rules)

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

@echovl echovl requested a review from a team as a code owner June 4, 2022 22:02
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 74.188% when pulling c039967 on echovl:fix/validate-map into 9e2ea40 on go-playground:master.

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 this pull request may close these issues.

required_without rule results in panic or error when validateMap is used required_if panics with ValidateMap on simple map with a single rule

2 participants