diff --git a/AUTHORS.rst b/AUTHORS.rst index 539d3e9f..c3082a80 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -79,3 +79,4 @@ Contributors (chronological) - Renato Damas `@codectl `_ - Tayler Sokalski `@tsokalski `_ - Sebastien Lovergne `@TheBigRoomXXL `_ +- Luna Lovegood `@duchuyvp `_ diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c7b07a21..944fc399 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,8 @@ Features: - ``MarshmallowPlugin``: Support different datetime formats for ``marshmallow.fields.DateTime`` fields (:issue:`814`). Thanks :user:`TheBigRoomXXL` for the suggestion and PR. +- ``MarshmallowPlugin``: Handle resolving names of schemas with spaces in the name (:pr:`856`). + Thanks :user:`duchuyvp` for the PR. Other changes: diff --git a/src/apispec/ext/marshmallow/__init__.py b/src/apispec/ext/marshmallow/__init__.py index 2595581d..46021005 100644 --- a/src/apispec/ext/marshmallow/__init__.py +++ b/src/apispec/ext/marshmallow/__init__.py @@ -89,8 +89,8 @@ def resolver(schema: type[Schema]) -> str: schema_cls = resolve_schema_cls(schema) name = schema_cls.__name__ if name.endswith("Schema"): - return name[:-6] or name - return name + name = name[:-6] or name + return name.strip() class MarshmallowPlugin(BasePlugin):