Skip to content

Commit

Permalink
Check type of parent todo for both pointer and struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathew Byrne committed Feb 4, 2019
1 parent 055fb4b commit fcf54d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion example/todo/todo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ func New() Config {
return nil, nil
case RoleOwner:
// This is also available in context
if obj != graphql.GetResolverContext(ctx).Parent.Result {
parent := graphql.GetResolverContext(ctx).Parent.Result
switch parent.(type) {
case Todo, *Todo:
default:
return nil, fmt.Errorf("parent type mismatch")
}
ownable, isOwnable := obj.(Ownable)
Expand Down

0 comments on commit fcf54d5

Please sign in to comment.