Closed pavel-boldyrev-form3 closed 1 year ago
I think this is a regression after https://github.com/go-openapi/strfmt/pull/105, particularly this line:
func (t DateTime) IsZero() bool { return time.Time(t).IsZero() }
I think IsZero() func should accept a pointer receiver, as it may be called on nil values.
IsZero()
nil
For example, I have a generated code from a swagger model that does the following check on an optional date-time field created_on in the request:
created_on
func (m *Entity) validateCreatedOn(formats strfmt.Registry) error { if swag.IsZero(m.CreatedOn) { // not required return nil } if err := validate.FormatOf("created_on", "body", "date-time", m.CreatedOn.String(), formats); err != nil { return err } return nil }
which now panics on the very first if statement.
if
Alternative: https://github.com/go-openapi/swag/pull/67
I think this is a regression after https://github.com/go-openapi/strfmt/pull/105, particularly this line:
I think
IsZero()
func should accept a pointer receiver, as it may be called onnil
values.For example, I have a generated code from a swagger model that does the following check on an optional date-time field
created_on
in the request:which now panics on the very first
if
statement.