Skip to content

Commit

Permalink
Fix schema name that has end with space for redoc ui and elements ui (#…
Browse files Browse the repository at this point in the history
…856)

* Fix resolver function with schema has spaces in name

* Minor cleanup and changelog update

---------

Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
duchuyvp and sloria authored Jan 10, 2024
1 parent 1ac6f55 commit 8af6453
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ Contributors (chronological)
- Renato Damas `@codectl <https://github.com/codectl>`_
- Tayler Sokalski `@tsokalski <https://github.com/tsokalski>`_
- Sebastien Lovergne `@TheBigRoomXXL <https://github.com/TheBigRoomXXL>`_
- Luna Lovegood `@duchuyvp <https://github.com/duchuyvp>`_
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions src/apispec/ext/marshmallow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8af6453

Please sign in to comment.