Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
Using the exclude_with or exclude_without tags don't work as expected on pointer fields (e.g. *string).
See the example below, where the validation fails even though the "excluded" fields are never included. Change the types from *string to string and now the validation succeeds.
Code sample, to showcase or reproduce:
type Test1 struct {
Field1 string
Field2 *string `validate:"excluded_with=Field1"`
}
type Test2 struct {
Field1 string
Field2 *string `validate:"excluded_without=Field1"`
}
func main() {
v := validator.New()
fmt.Println(v.Struct(&Test1{Field1: "ok"})) // Fails, even though Field2 is null
fmt.Println(v.Struct(&Test2{Field1: "ok"})) // Fails, even though Field2 is null
}
https://play.golang.org/p/QTjxLJOSF8W
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
Using the
exclude_withorexclude_withouttags don't work as expected on pointer fields (e.g.*string).See the example below, where the validation fails even though the "excluded" fields are never included. Change the types from
*stringtostringand now the validation succeeds.Code sample, to showcase or reproduce:
https://play.golang.org/p/QTjxLJOSF8W