graphene/graphene/types/inputfield.py
Syrus Akbary 4b71465922 Improved lazy types support in Graphene
This commit also adds support for string types in Field, InputField, List and NonNull, where the string will be import. Usage like: Field("graphene.String")
2017-04-06 22:13:06 -07:00

23 lines
712 B
Python

from .mountedtype import MountedType
from .structures import NonNull
from .utils import get_type
class InputField(MountedType):
def __init__(self, type, name=None, default_value=None,
deprecation_reason=None, description=None,
required=False, _creation_counter=None, **extra_args):
super(InputField, self).__init__(_creation_counter=_creation_counter)
self.name = name
if required:
type = NonNull(type)
self._type = type
self.deprecation_reason = deprecation_reason
self.default_value = default_value
self.description = description
@property
def type(self):
return get_type(self._type)