mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Renamed Generic to GenericScalar
This commit is contained in:
parent
8b0cd488d4
commit
11bed46a26
|
@ -7,9 +7,9 @@ from graphene.types.scalars import MIN_INT, MAX_INT
|
|||
from .scalars import Scalar
|
||||
|
||||
|
||||
class Generic(Scalar):
|
||||
class GenericScalar(Scalar):
|
||||
"""
|
||||
The `Generic` scalar type represents a generic
|
||||
The `GenericScalar` scalar type represents a generic
|
||||
GraphQL scalar value that could be:
|
||||
String, Boolean, Int, Float, List or Object.
|
||||
"""
|
||||
|
@ -32,8 +32,8 @@ class Generic(Scalar):
|
|||
elif isinstance(ast, FloatValue):
|
||||
return float(ast.value)
|
||||
elif isinstance(ast, ListValue):
|
||||
return [Generic.parse_literal(value) for value in ast.values]
|
||||
return [GenericScalar.parse_literal(value) for value in ast.values]
|
||||
elif isinstance(ast, ObjectValue):
|
||||
return {field.name.value: Generic.parse_literal(field.value) for field in ast.fields}
|
||||
return {field.name.value: GenericScalar.parse_literal(field.value) for field in ast.fields}
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from ..generic import Generic
|
||||
from ..generic import GenericScalar
|
||||
from ..objecttype import ObjectType
|
||||
from ..schema import Schema
|
||||
|
||||
|
||||
class Query(ObjectType):
|
||||
generic = Generic(input=Generic())
|
||||
generic = GenericScalar(input=GenericScalar())
|
||||
|
||||
def resolve_generic(self, args, context, info):
|
||||
input = args.get('input')
|
||||
|
@ -45,7 +45,7 @@ def test_generic_query_variable():
|
|||
None
|
||||
]:
|
||||
result = schema.execute(
|
||||
'''query Test($generic: Generic){ generic(input: $generic) }''',
|
||||
'''query Test($generic: GenericScalar){ generic(input: $generic) }''',
|
||||
variable_values={'generic': generic_value}
|
||||
)
|
||||
assert not result.errors
|
||||
|
|
Loading…
Reference in New Issue
Block a user