We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8403951 commit 9d304f9Copy full SHA for 9d304f9
graphql/utils/ast_from_value.py
@@ -1,5 +1,4 @@
1
import json
2
-import re
3
import sys
4
5
from six import string_types
@@ -12,6 +11,7 @@
12
11
GraphQLNonNull,
13
)
14
from ..type.scalars import GraphQLFloat
+from .assert_valid_name import COMPILED_NAME_PATTERN
15
16
17
def ast_from_value(value, type=None):
@@ -45,9 +45,7 @@ def ast_from_value(value, type=None):
45
return ast.FloatValue(string_num)
46
47
if isinstance(value, string_types):
48
- if isinstance(type, GraphQLEnumType) and re.match(
49
- r"^[_a-zA-Z][_a-zA-Z0-9]*$", value
50
- ):
+ if isinstance(type, GraphQLEnumType) and COMPILED_NAME_PATTERN.match(value):
51
return ast.EnumValue(value)
52
53
return ast.StringValue(json.dumps(value)[1:-1])
0 commit comments