GraphQL specify array of multiple types

GraphQL specify array of multiple types

Is there any way to tell GraphQL that a type is an array filled with Strings OR Integers? Basically this, if it were valid
inputHelper: [[String | Int]]

So in a query I could validly send over
inputHelper: [[“foo”, 1], [“bar”, -1]]

Solutions/Answers:

Solution 1:

You could potentially create a custom scalar that could accept either integers or strings.

The easier solution would be to utilize an existing JSON scalar, like the one here. Then you could just do:

inputHelper: [JSON]

or just

inputHelper: JSON

References

Related:  graphql-tag/index has no exported member 'gql'