mirror of
https://github.com/graphql-python/graphene.git
synced 2024-12-01 22:14:02 +03:00
Improved resolver function decorators
This commit is contained in:
parent
967a9d2d03
commit
28414955a2
|
@ -63,6 +63,9 @@ class Field(OrderedType):
|
||||||
return NonNull(self.type)
|
return NonNull(self.type)
|
||||||
return self.type
|
return self.type
|
||||||
|
|
||||||
|
def decorate_resolver(self, resolver):
|
||||||
|
return snake_case_args(resolver)
|
||||||
|
|
||||||
def internal_type(self, schema):
|
def internal_type(self, schema):
|
||||||
resolver = self.resolver
|
resolver = self.resolver
|
||||||
description = self.description
|
description = self.description
|
||||||
|
@ -85,9 +88,9 @@ class Field(OrderedType):
|
||||||
return my_resolver(instance, args, info)
|
return my_resolver(instance, args, info)
|
||||||
resolver = wrapped_func
|
resolver = wrapped_func
|
||||||
|
|
||||||
resolver = snake_case_args(resolver)
|
|
||||||
assert type, 'Internal type for field %s is None' % str(self)
|
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,)
|
description=description,)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user