Gqlgen: generated.go has wrong complexity strings generated?

Created on 10 Apr 2019  路  2Comments  路  Source: 99designs/gqlgen

For complexity calculation, the generated files generated.go have both typeName and field name capitalized as in example here:
https://github.com/99designs/gqlgen/blob/master/example/selection/generated.go#L83

But when I actually log the argument when I run a query against it, the field name is not capitalized so it does not match against the switch. such as "Like.collected" instead of "Like.Collected".

In complexity_test.go, the stub also used lower case.
https://github.com/99designs/gqlgen/blob/master/complexity/complexity_test.go#L212

Did I misconfigure something?

bug v0.9

All 2 comments

And also, I think we should add

    if field == "__typename" {
        return 0, true
    }

to exclude __typename in complexity calculation by default

I just opened a pull request #668 to address this. It seems to solve it for me.

Was this page helpful?
0 / 5 - 0 ratings