Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated.go has wrong complexity strings generated? #669

Closed
DBL-Lee opened this issue Apr 10, 2019 · 2 comments
Closed

generated.go has wrong complexity strings generated? #669

DBL-Lee opened this issue Apr 10, 2019 · 2 comments
Labels
bug Something isn't working v0.9 Fixed in 0.9.0

Comments

@DBL-Lee
Copy link
Contributor

DBL-Lee commented Apr 10, 2019

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?

@DBL-Lee
Copy link
Contributor Author

DBL-Lee commented Apr 10, 2019

And also, I think we should add

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

to exclude __typename in complexity calculation by default

@mbranch
Copy link
Contributor

mbranch commented Apr 12, 2019

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

@mathewbyrne mathewbyrne added the bug Something isn't working label Apr 14, 2019
@vektah vektah closed this as completed May 12, 2019
@vektah vektah added the v0.9 Fixed in 0.9.0 label May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.9 Fixed in 0.9.0
Projects
None yet
Development

No branches or pull requests

4 participants