Skip to content

Release 1.2.0 breaking change #26

@matdurand

Description

@matdurand

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions