|
1 | 1 | import six
|
2 | 2 | from collections import OrderedDict
|
| 3 | +from functools import wraps |
3 | 4 |
|
4 | 5 | from graphql.core.type import GraphQLField, GraphQLInputObjectField
|
5 | 6 |
|
6 | 7 | from .base import LazyType, OrderedType
|
7 | 8 | from .argument import ArgumentsGroup
|
8 | 9 | from .definitions import NonNull
|
9 |
| -from ...utils import to_camel_case |
| 10 | +from ...utils import to_camel_case, ProxySnakeDict |
10 | 11 | from ..types import BaseObjectType, InputObjectType
|
11 | 12 |
|
12 | 13 |
|
| 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 | + |
13 | 22 | class Empty(object):
|
14 | 23 | pass
|
15 | 24 |
|
@@ -72,6 +81,7 @@ def internal_type(self, schema):
|
72 | 81 | arguments = type_objecttype.get_arguments()
|
73 | 82 | resolver = getattr(type_objecttype, 'mutate')
|
74 | 83 |
|
| 84 | + resolver = make_args_snake_case(resolver) |
75 | 85 | assert type, 'Internal type for field %s is None' % str(self)
|
76 | 86 | return GraphQLField(type, args=schema.T(arguments), resolver=resolver,
|
77 | 87 | description=description,)
|
|
0 commit comments