From 28414955a2c217e762b039b5bd57d5d4db56de49 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Thu, 3 Dec 2015 23:41:28 -0800 Subject: [PATCH] Improved resolver function decorators --- graphene/core/types/field.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/graphene/core/types/field.py b/graphene/core/types/field.py index d7643b5e..c3fa712f 100644 --- a/graphene/core/types/field.py +++ b/graphene/core/types/field.py @@ -63,6 +63,9 @@ class Field(OrderedType): return NonNull(self.type) return self.type + def decorate_resolver(self, resolver): + return snake_case_args(resolver) + def internal_type(self, schema): resolver = self.resolver description = self.description @@ -85,9 +88,9 @@ class Field(OrderedType): return my_resolver(instance, args, info) resolver = wrapped_func - resolver = snake_case_args(resolver) assert type, 'Internal type for field %s is None' % str(self) - return GraphQLField(type, args=schema.T(arguments), resolver=resolver, + return GraphQLField(type, args=schema.T(arguments), + resolver=self.decorate_resolver(resolver), description=description,) def __repr__(self):