简体   繁体   中英

GraphQL Schema Definition Error

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM