-
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
Unique tag panics if value is nil #749
Comments
Thanks @Jake-Convictional I'll have to think about this. By the way I noticed you've been posting here a bit and I'm looking for others to help maintain this and some other libs as it's hard time wise for me to keep up, would you be interested? |
I have created a PR to fix this issue: #1041 I chose to implement this behavior :
|
Fix #749 Co-authored-by: Yann Salaün <ysalaun@yubik.io>
Package version eg. v9, v10:
v10 (introduced in 10.4.0)
Issue, Question or Enhancement:
If a pointer field involved in a unique tag is
nil
then the validator panics withThis is a bug because
nil
is a valid state for pointer fields, and this behavior would require the user to validate they don't have a nil value before running the rest of the validation (which is silly). I'm assuming this bug was introduced by #644 (though I didn't take a close look, the bug does not exist in v10.3.0, but does exist in v10.4.0 onward). To resolve, maybe just needs a condition to check if the value is nil.As for the expected behavior, I think the alternatives are:
required
tag to the unique field.Code sample, to showcase or reproduce:
Playground sample
The text was updated successfully, but these errors were encountered: