Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove leading whitespaces in multi-line descriptions #1490

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion graphene/types/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .unmountedtype import UnmountedType
from .utils import get_type
from ..utils.deprecated import warn_deprecation
from ..utils.trim_docstring import trim_docstring

base_type = type

Expand Down Expand Up @@ -108,7 +109,7 @@ def __init__(
resolver = partial(source_resolver, source)
self.resolver = resolver
self.deprecation_reason = deprecation_reason
self.description = description
self.description = trim_docstring(description)
self.default_value = default_value

@property
Expand Down
6 changes: 4 additions & 2 deletions graphene/types/unmountedtype.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ..utils.orderedtype import OrderedType

from ..utils.trim_docstring import trim_docstring

class UnmountedType(OrderedType):
"""
Expand Down Expand Up @@ -43,7 +43,9 @@ def __init__(self, *args, **kwargs):
super(UnmountedType, self).__init__()
self.args = args
self.kwargs = kwargs

if 'description' in self.kwargs:
self.kwargs['description'] = trim_docstring(self.kwargs['description'])

def get_type(self):
"""
This function is called when the UnmountedType instance
Expand Down