0
votes

I am trying to define GraphQL schema like this:

type Obj { id: Int 0_100: Int }

But it gives following exception.

'GraphQLError: Syntax Error: Expected Name, found Int "0"',

How can I define attribute starting with numeric, -, + signs.

2

2 Answers

2
votes

Numerical parameter names do not work in GraphQL.

You can probably prefix it with a string like _0_100, but it's fairly unusual and I'd recommend against it. Consider using words to name your parameters instead.

2
votes

This is the regexp for names in GraphQL: /[_A-Za-z][_0-9A-Za-z]*/. Anything that does not match is not allowed.

http://facebook.github.io/graphql/June2018/#sec-Names