Merge pull request #2 from hvanvoorhis-ISP/patch-1

Update dependency.go
This commit is contained in:
Daniel G. Taylor 2020-05-30 15:12:25 -07:00 committed by GitHub
commit 5bf4593498
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,7 +94,7 @@ func (d *openAPIDependency) validate(returnType reflect.Type) {
v := reflect.ValueOf(d.handler)
if v.Kind() != reflect.Func {
if returnType != nil && returnType != v.Type() {
if returnType != nil && returnType != v.Type() && !v.Type().Implements(returnType) {
panic(fmt.Errorf("return type should be %s but got %s: %w", v.Type(), returnType, ErrDependencyInvalid))
}