Skip to content

Commit 862fa6f

Browse files
committed
Fixed argument types
1 parent 41648b5 commit 862fa6f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

graphene/core/types/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, *args, **kwargs):
5959
class ArgumentType(MirroredType):
6060
def as_argument(self):
6161
from .argument import Argument
62-
return Argument(self.__class__, _creation_counter=self.creation_counter, *self.args, **self.kwargs)
62+
return Argument(self, _creation_counter=self.creation_counter, *self.args, **self.kwargs)
6363

6464

6565
class FieldType(MirroredType):

graphene/core/types/field.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
import six
22
from collections import OrderedDict
3+
from functools import wraps
34

45
from graphql.core.type import GraphQLField, GraphQLInputObjectField
56

67
from .base import LazyType, OrderedType
78
from .argument import ArgumentsGroup
89
from .definitions import NonNull
9-
from ...utils import to_camel_case
10+
from ...utils import to_camel_case, ProxySnakeDict
1011
from ..types import BaseObjectType, InputObjectType
1112

1213

14+
def make_args_snake_case(resolver):
15+
@wraps(resolver)
16+
def wrapped_resolver(instance, args, info):
17+
return resolver(instance, ProxySnakeDict(args), info)
18+
19+
return wrapped_resolver
20+
21+
1322
class Empty(object):
1423
pass
1524

@@ -72,6 +81,7 @@ def internal_type(self, schema):
7281
arguments = type_objecttype.get_arguments()
7382
resolver = getattr(type_objecttype, 'mutate')
7483

84+
resolver = make_args_snake_case(resolver)
7585
assert type, 'Internal type for field %s is None' % str(self)
7686
return GraphQLField(type, args=schema.T(arguments), resolver=resolver,
7787
description=description,)

0 commit comments

Comments
 (0)