-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
requiredIf/requiredUnless doesn't work on bool field #683
Comments
I found the same issue |
@bluven did you open a PR with this? |
@itsleeowen No. I didn't |
Looks to be the same problem with type Person struct {
Name bool `validate:"eqfield=Age"`
Age bool
}
person := Person{
Name: true,
Age: false,
} |
If this is blocking others like it was for me you can temporarily point your mod file at my fork (same commit sha as the PR above) by running the following:
|
Thank you for your work. Yesterday I was surprised that required_if did not work with boolean fields. |
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
Issue
Code sample, to showcase or reproduce:
I checked how requiredIf/requiredUnless is implemented, it seems this function doesn't has bool branch:
I tried add a bool branch test like this and it worked:
The last return
feld.String() == value
doesn't work on bool field, because the String() will return<bool Value>
The text was updated successfully, but these errors were encountered: