diff --git a/graphene/types/enum.py b/graphene/types/enum.py index 3bff137c..a6575cea 100644 --- a/graphene/types/enum.py +++ b/graphene/types/enum.py @@ -3,6 +3,7 @@ from collections import OrderedDict import six from ..utils.is_base_type import is_base_type +from ..utils.trim_docstring import trim_docstring from .options import Options from .unmountedtype import UnmountedType @@ -23,7 +24,7 @@ class EnumTypeMeta(type): options = Options( attrs.pop('Meta', None), name=name, - description=attrs.get('__doc__'), + description=trim_docstring(attrs.get('__doc__')), enum=None, ) if not options.enum: diff --git a/graphene/types/inputobjecttype.py b/graphene/types/inputobjecttype.py index cbc13f95..1796988a 100644 --- a/graphene/types/inputobjecttype.py +++ b/graphene/types/inputobjecttype.py @@ -1,6 +1,7 @@ import six from ..utils.is_base_type import is_base_type +from ..utils.trim_docstring import trim_docstring from .abstracttype import AbstractTypeMeta from .inputfield import InputField from .options import Options @@ -19,7 +20,7 @@ class InputObjectTypeMeta(AbstractTypeMeta): options = Options( attrs.pop('Meta', None), name=name, - description=attrs.get('__doc__'), + description=trim_docstring(attrs.get('__doc__')), local_fields=None, ) diff --git a/graphene/types/interface.py b/graphene/types/interface.py index cc8361e6..f0980b6c 100644 --- a/graphene/types/interface.py +++ b/graphene/types/interface.py @@ -1,6 +1,7 @@ import six from ..utils.is_base_type import is_base_type +from ..utils.trim_docstring import trim_docstring from .abstracttype import AbstractTypeMeta from .field import Field from .options import Options @@ -18,7 +19,7 @@ class InterfaceMeta(AbstractTypeMeta): options = Options( attrs.pop('Meta', None), name=name, - description=attrs.get('__doc__'), + description=trim_docstring(attrs.get('__doc__')), local_fields=None, ) diff --git a/graphene/types/objecttype.py b/graphene/types/objecttype.py index f06dbf5e..9b9e1005 100644 --- a/graphene/types/objecttype.py +++ b/graphene/types/objecttype.py @@ -3,6 +3,7 @@ from collections import OrderedDict import six from ..utils.is_base_type import is_base_type +from ..utils.trim_docstring import trim_docstring from .abstracttype import AbstractTypeMeta from .field import Field from .interface import Interface @@ -22,7 +23,7 @@ class ObjectTypeMeta(AbstractTypeMeta): options = _meta or Options( attrs.pop('Meta', None), name=name, - description=attrs.get('__doc__'), + description=trim_docstring(attrs.get('__doc__')), interfaces=(), local_fields=OrderedDict(), ) diff --git a/graphene/types/scalars.py b/graphene/types/scalars.py index 6f07c91c..e1ff80d3 100644 --- a/graphene/types/scalars.py +++ b/graphene/types/scalars.py @@ -1,9 +1,9 @@ import six - from graphql.language.ast import (BooleanValue, FloatValue, IntValue, StringValue) from ..utils.is_base_type import is_base_type +from ..utils.trim_docstring import trim_docstring from .options import Options from .unmountedtype import UnmountedType @@ -19,7 +19,7 @@ class ScalarTypeMeta(type): options = Options( attrs.pop('Meta', None), name=name, - description=attrs.get('__doc__'), + description=trim_docstring(attrs.get('__doc__')), ) return type.__new__(cls, name, bases, dict(attrs, _meta=options)) diff --git a/graphene/types/union.py b/graphene/types/union.py index e36086d0..d4af88ed 100644 --- a/graphene/types/union.py +++ b/graphene/types/union.py @@ -1,6 +1,7 @@ import six from ..utils.is_base_type import is_base_type +from ..utils.trim_docstring import trim_docstring from .options import Options from .unmountedtype import UnmountedType @@ -16,7 +17,7 @@ class UnionMeta(type): options = Options( attrs.pop('Meta', None), name=name, - description=attrs.get('__doc__'), + description=trim_docstring(attrs.get('__doc__')), types=(), )