Skip to content

Commit

Permalink
Merge branch 'master' into refactor-textformatter-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrinzema authored Oct 6, 2020
2 parents 2940f41 + 8a70ab4 commit 6b620db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
6 changes: 3 additions & 3 deletions examples/graphql/flow.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
endpoint "latest_todo" "graphql" {
path = "latest.todo"
path = "todo.latest"
name = "LatestTodo"
base = "query"
}
Expand All @@ -20,8 +20,8 @@ flow "latest_todo" {
}

endpoint "todo" "graphql" {
path = "todo"
name = "Todo"
path = "todo.query"
name = "TodoQuery"
base = "query"
}

Expand Down
17 changes: 2 additions & 15 deletions pkg/transport/graphql/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ func SetFieldPath(object *graphql.Object, path string, field *graphql.Field) err
target, has := fields[key]

if len(parts) > 1 {
config := graphql.ObjectConfig{
nested := graphql.NewObject(graphql.ObjectConfig{
Name: key,
Fields: make(graphql.Fields),
}

nested := graphql.NewObject(config)
})

if has {
result, isObject := target.Type.(*graphql.Object)
Expand All @@ -96,17 +94,6 @@ func SetFieldPath(object *graphql.Object, path string, field *graphql.Field) err
nested = result
}

part := &graphql.Field{
Name: key,
Type: nested,
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
return p.Source, nil
},
}

object.AddFieldConfig(key, part)
object.Fields()

return SetFieldPath(nested, NewPath(parts[1:]), field)
}

Expand Down

0 comments on commit 6b620db

Please sign in to comment.