Fix bug causing a panic in hook field resolver
By default field resolvers will use reflection to resolve a specific field, however, the default resolver has issues traversing embedded types. As such when it was trying to resolve the hook config field it was leading to a panic.
@@ -20,6 +20,12 @@ type hookImpl struct {
schema.HookAliases
}
+// Config implements response to request for 'config' field.
+func (*hookImpl) Config(p graphql.ResolveParams) (interface{}, error) {
+ hook := p.Source.(*corev2.Hook)
+ return &hook.HookConfig, nil
+}
+
// IsTypeOf is used to determine if a given value is associated with the type
func (*hookImpl) IsTypeOf(s interface{}, p graphql.IsTypeOfParams) bool {
_, ok := s.(*corev2.Hook)
