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

Arrays are not recognized as iterable #323

Closed
alexflint opened this issue May 10, 2018 · 1 comment
Closed

Arrays are not recognized as iterable #323

alexflint opened this issue May 10, 2018 · 1 comment

Comments

@alexflint
Copy link
Contributor

In my code I use the following type to represent points in 2d

type Vec2 [2]float64

I realize that graphql does not have any explicit representation for fixed-size arrays so I'm happy to expose this in the api as simple a list of floats, ie

graphql.NewList(graphql.Float)

However, when I register this field, I get an error saying that my field is not iterable. If instead I return a slice from my resolver then I get the expected behavior. This is rather frustrating as I have to manually register a resolver everywhere that I return a Vec2 to turn the array into a slice.

I think this library should recognize fixed-size arrays as iterable.

@alexflint
Copy link
Contributor Author

Here is the line that causes the problem:

https://github.com/graphql-go/graphql/blob/master/executor.go#L785

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant