@@ -1797,19 +1797,19 @@ func hasValue(fl FieldLevel) bool {
1797
1797
}
1798
1798
1799
1799
// requireCheckFieldKind is a func for check field kind
1800
- func requireCheckFieldKind (fl FieldLevel , param string , defaultNotFoundValue bool ) bool {
1800
+ func requireCheckFieldKind (fl FieldLevel , param string ) bool {
1801
1801
field := fl .Field ()
1802
1802
kind := field .Kind ()
1803
1803
var nullable , found bool
1804
1804
if len (param ) > 0 {
1805
1805
field , kind , nullable , found = fl .GetStructFieldOKAdvanced2 (fl .Parent (), param )
1806
1806
if ! found {
1807
- return defaultNotFoundValue
1807
+ return true
1808
1808
}
1809
1809
}
1810
1810
switch kind {
1811
1811
case reflect .Invalid :
1812
- return defaultNotFoundValue
1812
+ return true
1813
1813
case reflect .Slice , reflect .Map , reflect .Ptr , reflect .Interface , reflect .Chan , reflect .Func :
1814
1814
return field .IsNil ()
1815
1815
default :
@@ -1943,7 +1943,7 @@ func excludedUnless(fl FieldLevel) bool {
1943
1943
func excludedWith (fl FieldLevel ) bool {
1944
1944
params := parseOneOfParam2 (fl .Param ())
1945
1945
for _ , param := range params {
1946
- if ! requireCheckFieldKind (fl , param , true ) {
1946
+ if ! requireCheckFieldKind (fl , param ) {
1947
1947
return ! hasValue (fl )
1948
1948
}
1949
1949
}
@@ -1955,7 +1955,7 @@ func excludedWith(fl FieldLevel) bool {
1955
1955
func requiredWith (fl FieldLevel ) bool {
1956
1956
params := parseOneOfParam2 (fl .Param ())
1957
1957
for _ , param := range params {
1958
- if ! requireCheckFieldKind (fl , param , true ) {
1958
+ if ! requireCheckFieldKind (fl , param ) {
1959
1959
return hasValue (fl )
1960
1960
}
1961
1961
}
@@ -1967,7 +1967,7 @@ func requiredWith(fl FieldLevel) bool {
1967
1967
func excludedWithAll (fl FieldLevel ) bool {
1968
1968
params := parseOneOfParam2 (fl .Param ())
1969
1969
for _ , param := range params {
1970
- if requireCheckFieldKind (fl , param , true ) {
1970
+ if requireCheckFieldKind (fl , param ) {
1971
1971
return true
1972
1972
}
1973
1973
}
@@ -1979,7 +1979,7 @@ func excludedWithAll(fl FieldLevel) bool {
1979
1979
func requiredWithAll (fl FieldLevel ) bool {
1980
1980
params := parseOneOfParam2 (fl .Param ())
1981
1981
for _ , param := range params {
1982
- if requireCheckFieldKind (fl , param , true ) {
1982
+ if requireCheckFieldKind (fl , param ) {
1983
1983
return true
1984
1984
}
1985
1985
}
@@ -1989,7 +1989,7 @@ func requiredWithAll(fl FieldLevel) bool {
1989
1989
// excludedWithout is the validation function
1990
1990
// The field under validation must not be present or is empty when any of the other specified fields are not present.
1991
1991
func excludedWithout (fl FieldLevel ) bool {
1992
- if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ()), true ) {
1992
+ if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ())) {
1993
1993
return ! hasValue (fl )
1994
1994
}
1995
1995
return true
@@ -1998,7 +1998,7 @@ func excludedWithout(fl FieldLevel) bool {
1998
1998
// requiredWithout is the validation function
1999
1999
// The field under validation must be present and not empty only when any of the other specified fields are not present.
2000
2000
func requiredWithout (fl FieldLevel ) bool {
2001
- if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ()), true ) {
2001
+ if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ())) {
2002
2002
return hasValue (fl )
2003
2003
}
2004
2004
return true
@@ -2009,7 +2009,7 @@ func requiredWithout(fl FieldLevel) bool {
2009
2009
func excludedWithoutAll (fl FieldLevel ) bool {
2010
2010
params := parseOneOfParam2 (fl .Param ())
2011
2011
for _ , param := range params {
2012
- if ! requireCheckFieldKind (fl , param , true ) {
2012
+ if ! requireCheckFieldKind (fl , param ) {
2013
2013
return true
2014
2014
}
2015
2015
}
@@ -2021,7 +2021,7 @@ func excludedWithoutAll(fl FieldLevel) bool {
2021
2021
func requiredWithoutAll (fl FieldLevel ) bool {
2022
2022
params := parseOneOfParam2 (fl .Param ())
2023
2023
for _ , param := range params {
2024
- if ! requireCheckFieldKind (fl , param , true ) {
2024
+ if ! requireCheckFieldKind (fl , param ) {
2025
2025
return true
2026
2026
}
2027
2027
}
0 commit comments