forked from go-ozzo/ozzo-validation
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hi,
It seem the new behavior of IsEmpty is actually a breaking change.
It doesn't make sense to me that the "Required" check out fail on this
type MyInterface1 interface {
Foo() string
}
type Impl struct {
Name string
}
func (i *Impl) Foo() string {
return i.Name
}
type MyStruct struct {
I1 MyInterface1
}
func main() {
foo := &Impl{Name: ""}
st := &MyStruct{I1: foo}
err := validation.ValidateStruct(st,
validation.Field(&st.I1, validation.Required),
)
if err != nil {
panic(err)
}
}
but would work if I change foo := &Impl{Name: ""} to foo := &Impl{Name: "something"}.
As long as the interface points to something, required should be satisfied. Am I missing something?
maxfierke and elliehastings
Metadata
Metadata
Assignees
Labels
No labels