Skip to content

Commit 841c2c6

Browse files
committed
incorporate fix for Go 1.16 from upstream PR go-openapi#138 on top of v0.19.8
As reported in go-openapi#137, changes in Go 1.16's `reflect` package cause the type validator to fail now. Incorporate a fix from go-openapi#138 to fix that. For the time being, for internal compatibility and transitive dependency issues, we need to stick with v0.19.8. But to unblock upgrading to Go 1.16.0, we need this hotfix.
1 parent f2f9aec commit 841c2c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (t *typeValidator) Applies(source interface{}, kind reflect.Kind) bool {
137137
func (t *typeValidator) Validate(data interface{}) *Result {
138138
result := new(Result)
139139
result.Inc()
140-
if data == nil || reflect.DeepEqual(reflect.Zero(reflect.TypeOf(data)), reflect.ValueOf(data)) {
140+
if data == nil {
141141
// nil or zero value for the passed structure require Type: null
142142
if len(t.Type) > 0 && !t.Type.Contains(nullType) && !t.Nullable { // TODO: if a property is not required it also passes this
143143
return errorHelp.sErr(errors.InvalidType(t.Path, t.In, strings.Join(t.Type, ","), nullType))

0 commit comments

Comments
 (0)