@@ -1797,19 +1797,19 @@ func hasValue(fl FieldLevel) bool {
17971797}
17981798
17991799// 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 {
18011801 field := fl .Field ()
18021802 kind := field .Kind ()
18031803 var nullable , found bool
18041804 if len (param ) > 0 {
18051805 field , kind , nullable , found = fl .GetStructFieldOKAdvanced2 (fl .Parent (), param )
18061806 if ! found {
1807- return defaultNotFoundValue
1807+ return true
18081808 }
18091809 }
18101810 switch kind {
18111811 case reflect .Invalid :
1812- return defaultNotFoundValue
1812+ return true
18131813 case reflect .Slice , reflect .Map , reflect .Ptr , reflect .Interface , reflect .Chan , reflect .Func :
18141814 return field .IsNil ()
18151815 default :
@@ -1943,7 +1943,7 @@ func excludedUnless(fl FieldLevel) bool {
19431943func excludedWith (fl FieldLevel ) bool {
19441944 params := parseOneOfParam2 (fl .Param ())
19451945 for _ , param := range params {
1946- if ! requireCheckFieldKind (fl , param , true ) {
1946+ if ! requireCheckFieldKind (fl , param ) {
19471947 return ! hasValue (fl )
19481948 }
19491949 }
@@ -1955,7 +1955,7 @@ func excludedWith(fl FieldLevel) bool {
19551955func requiredWith (fl FieldLevel ) bool {
19561956 params := parseOneOfParam2 (fl .Param ())
19571957 for _ , param := range params {
1958- if ! requireCheckFieldKind (fl , param , true ) {
1958+ if ! requireCheckFieldKind (fl , param ) {
19591959 return hasValue (fl )
19601960 }
19611961 }
@@ -1967,7 +1967,7 @@ func requiredWith(fl FieldLevel) bool {
19671967func excludedWithAll (fl FieldLevel ) bool {
19681968 params := parseOneOfParam2 (fl .Param ())
19691969 for _ , param := range params {
1970- if requireCheckFieldKind (fl , param , true ) {
1970+ if requireCheckFieldKind (fl , param ) {
19711971 return true
19721972 }
19731973 }
@@ -1979,7 +1979,7 @@ func excludedWithAll(fl FieldLevel) bool {
19791979func requiredWithAll (fl FieldLevel ) bool {
19801980 params := parseOneOfParam2 (fl .Param ())
19811981 for _ , param := range params {
1982- if requireCheckFieldKind (fl , param , true ) {
1982+ if requireCheckFieldKind (fl , param ) {
19831983 return true
19841984 }
19851985 }
@@ -1989,7 +1989,7 @@ func requiredWithAll(fl FieldLevel) bool {
19891989// excludedWithout is the validation function
19901990// The field under validation must not be present or is empty when any of the other specified fields are not present.
19911991func excludedWithout (fl FieldLevel ) bool {
1992- if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ()), true ) {
1992+ if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ())) {
19931993 return ! hasValue (fl )
19941994 }
19951995 return true
@@ -1998,7 +1998,7 @@ func excludedWithout(fl FieldLevel) bool {
19981998// requiredWithout is the validation function
19991999// The field under validation must be present and not empty only when any of the other specified fields are not present.
20002000func requiredWithout (fl FieldLevel ) bool {
2001- if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ()), true ) {
2001+ if requireCheckFieldKind (fl , strings .TrimSpace (fl .Param ())) {
20022002 return hasValue (fl )
20032003 }
20042004 return true
@@ -2009,7 +2009,7 @@ func requiredWithout(fl FieldLevel) bool {
20092009func excludedWithoutAll (fl FieldLevel ) bool {
20102010 params := parseOneOfParam2 (fl .Param ())
20112011 for _ , param := range params {
2012- if ! requireCheckFieldKind (fl , param , true ) {
2012+ if ! requireCheckFieldKind (fl , param ) {
20132013 return true
20142014 }
20152015 }
@@ -2021,7 +2021,7 @@ func excludedWithoutAll(fl FieldLevel) bool {
20212021func requiredWithoutAll (fl FieldLevel ) bool {
20222022 params := parseOneOfParam2 (fl .Param ())
20232023 for _ , param := range params {
2024- if ! requireCheckFieldKind (fl , param , true ) {
2024+ if ! requireCheckFieldKind (fl , param ) {
20252025 return true
20262026 }
20272027 }
0 commit comments