Skip to content

Commit

Permalink
Fix complexity case selection
Browse files Browse the repository at this point in the history
Use the GraphQL field name rather than the Go field name in the generated
`Complextity` func.

Before this patch, overloading complexity funcs was ineffective because they
were never executed.
  • Loading branch information
mbranch committed Apr 12, 2019
1 parent 5ff6092 commit 125021a
Show file tree
Hide file tree
Showing 16 changed files with 325 additions and 204 deletions.
2 changes: 1 addition & 1 deletion codegen/generated!.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
{{ if not $object.IsReserved }}
{{ range $field := $object.UniqueFields }}
{{ if not $field.IsReserved }}
case "{{$object.Name}}.{{$field.GoFieldName}}":
case "{{$object.Name}}.{{$field.Name}}":
if e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}} == nil {
break
}
Expand Down
Loading

0 comments on commit 125021a

Please sign in to comment.