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

Add support for excluded_with on pointer fields #746

Merged
merged 2 commits into from Apr 6, 2021

Conversation

Jake-Convictional
Copy link
Contributor

@Jake-Convictional Jake-Convictional commented Mar 31, 2021

Fixes Or Enhances

Closes #745

Using a tag like excluded_with will now work as expected on pointer fields (e.g. *string). There are two commits here. The first commit adds in tests (which fail) to demonstrate the behavior that was missing. The second commit improves the code so that the tests pass.

I checked to see if this would also address this comment about struct pointers, but it does not.

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/admins

@@ -10352,9 +10417,10 @@ func TestExcludedWithoutAll(t *testing.T) {
Field2 *string `validate:"excluded_without_all=Field FieldE" json:"field_2"`
Field3 map[string]string `validate:"excluded_without_all=Field FieldE" json:"field_3"`
Field4 interface{} `validate:"excluded_without_all=Field FieldE" json:"field_4"`
Field5 string `validate:"excluded_without_all=Inner.Field Inner.Field2" json:"field_5"`
Field5 string `validate:"excluded_without_all=Inner.Field Inner2.Field" json:"field_5"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemed like a typo

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.07% when pulling b42122c on Jake-Convictional:exclude-nil into f6584a4 on go-playground:master.

@deankarn deankarn merged commit 9c415c4 into go-playground:master Apr 6, 2021
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.

exclude_with and exclude_without don't work on pointer fields
3 participants