Skip to content

Arrays are not recognized as iterable #323

Closed
@alexflint

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions