mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Fixed argument types
This commit is contained in:
parent
41648b5a94
commit
862fa6f312
|
@ -59,7 +59,7 @@ class MirroredType(OrderedType):
|
|||
class ArgumentType(MirroredType):
|
||||
def as_argument(self):
|
||||
from .argument import Argument
|
||||
return Argument(self.__class__, _creation_counter=self.creation_counter, *self.args, **self.kwargs)
|
||||
return Argument(self, _creation_counter=self.creation_counter, *self.args, **self.kwargs)
|
||||
|
||||
|
||||
class FieldType(MirroredType):
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
import six
|
||||
from collections import OrderedDict
|
||||
from functools import wraps
|
||||
|
||||
from graphql.core.type import GraphQLField, GraphQLInputObjectField
|
||||
|
||||
from .base import LazyType, OrderedType
|
||||
from .argument import ArgumentsGroup
|
||||
from .definitions import NonNull
|
||||
from ...utils import to_camel_case
|
||||
from ...utils import to_camel_case, ProxySnakeDict
|
||||
from ..types import BaseObjectType, InputObjectType
|
||||
|
||||
|
||||
def make_args_snake_case(resolver):
|
||||
@wraps(resolver)
|
||||
def wrapped_resolver(instance, args, info):
|
||||
return resolver(instance, ProxySnakeDict(args), info)
|
||||
|
||||
return wrapped_resolver
|
||||
|
||||
|
||||
class Empty(object):
|
||||
pass
|
||||
|
||||
|
@ -72,6 +81,7 @@ class Field(OrderedType):
|
|||
arguments = type_objecttype.get_arguments()
|
||||
resolver = getattr(type_objecttype, 'mutate')
|
||||
|
||||
resolver = make_args_snake_case(resolver)
|
||||
assert type, 'Internal type for field %s is None' % str(self)
|
||||
return GraphQLField(type, args=schema.T(arguments), resolver=resolver,
|
||||
description=description,)
|
||||
|
|
Loading…
Reference in New Issue
Block a user