diff --git a/validator.go b/validator.go index 342e72e..f097f39 100644 --- a/validator.go +++ b/validator.go @@ -249,7 +249,7 @@ OUTER: v.cf = cf v.ct = ct - if !v.fldIsPointer && !hasValue(v) { + if !hasValue(v) { return } diff --git a/validator_test.go b/validator_test.go index e8f5dd4..b5ff122 100644 --- a/validator_test.go +++ b/validator_test.go @@ -9265,6 +9265,16 @@ func TestRequiredWithout(t *testing.T) { AssertError(t, errs, "Field6", "Field6", "Field6", "Field6", "required_without") AssertError(t, errs, "Field7", "Field7", "Field7", "Field7", "required_without") AssertError(t, errs, "Field8", "Field8", "Field8", "Field8", "required_without") + + test3 := struct { + Field1 *string `validate:"required_without=Field2,omitempty,min=1" json:"field_1"` + Field2 *string `validate:"required_without=Field1,omitempty,min=1" json:"field_2"` + }{ + Field1: &fieldVal, + } + + errs = validate.Struct(&test3) + Equal(t, errs, nil) } func TestRequiredWithoutAll(t *testing.T) {