From 1ea911a902e7f2c48325e6072a791f34c7abe0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20=C4=90=E1=BB=A9c=20Huy?= <93045745+duchuyvp@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:07:50 +0700 Subject: [PATCH] Fix resolver function with schema has spaces in name --- AUTHORS.rst | 1 + src/apispec/ext/marshmallow/__init__.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 17bea2b9..39c485ee 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -78,3 +78,4 @@ Contributors (chronological) - Mounier Florian `@paradoxxxzero `_ - Renato Damas `@codectl `_ - Tayler Sokalski `@tsokalski `_ +- Luna Lovegood `@duchuyvp `_ \ No newline at end of file diff --git a/src/apispec/ext/marshmallow/__init__.py b/src/apispec/ext/marshmallow/__init__.py index 2595581d..6e118099 100644 --- a/src/apispec/ext/marshmallow/__init__.py +++ b/src/apispec/ext/marshmallow/__init__.py @@ -89,8 +89,9 @@ 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() + return name.strip() class MarshmallowPlugin(BasePlugin):