Graphiql: Allow number strings for an Enum Type's possible values

Created on 31 Aug 2017  路  3Comments  路  Source: graphql/graphiql

Since the name of the Enum serializes as a string, can the name of an enum value not start with a number (as a string)?
In my case, I was trying to use '031' (to represent '031') as one of the values for a custom Enum Type.

The implementation I'm using allowed it without error, but graphiql failed my schema on the assertValidName check since it only allows underscore and letters.

Most helpful comment

@davidianlandis @dncrews GraphQL require enum values to match [_A-Za-z][_0-9A-Za-z] RegExp:
http://facebook.github.io/graphql/October2016/#sec-Enum-Value
http://facebook.github.io/graphql/October2016/#Name

That means you cant use031as an enum value. If you can't change enum value to something valid (e.g._031) you can useString` instead.

All 3 comments

Can you try using process.env.GRAPHQL_NO_NAME_WARNING
as described here ?

I've come across this too. It sounds like it's a valid bug, as I haven't been able to find anything that says there are limitations around the enum naming convention.

@davidianlandis @dncrews GraphQL require enum values to match [_A-Za-z][_0-9A-Za-z] RegExp:
http://facebook.github.io/graphql/October2016/#sec-Enum-Value
http://facebook.github.io/graphql/October2016/#Name

That means you cant use031as an enum value. If you can't change enum value to something valid (e.g._031) you can useString` instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fson picture fson  路  17Comments

orta picture orta  路  10Comments

intellix picture intellix  路  10Comments

majkrzak picture majkrzak  路  12Comments

OlegIlyenko picture OlegIlyenko  路  17Comments