diff --git a/graphene/types/field.py b/graphene/types/field.py index b1122696..531c2f5c 100644 --- a/graphene/types/field.py +++ b/graphene/types/field.py @@ -3,8 +3,9 @@ from collections import Mapping, OrderedDict from functools import partial from ..utils.orderedtype import OrderedType -from .argument import to_arguments +from .argument import Argument, to_arguments from .structures import NonNull +from .unmountedtype import UnmountedType def source_resolver(source, root, args, context, info): @@ -30,6 +31,16 @@ class Field(OrderedType): if required: type = NonNull(type) + # Check if name is actually an argument of the field + if isinstance(name, (Argument, UnmountedType)): + extra_args['name'] = name + name = None + + # Check if source is actually an argument of the field + if isinstance(source, (Argument, UnmountedType)): + extra_args['source'] = source + source = None + self.name = name self._type = type self.args = to_arguments(args or OrderedDict(), extra_args)