Skip to content

Commit

Permalink
Fixed an issue where duplicate tags are created during the route rewr…
Browse files Browse the repository at this point in the history
…ite phase inside cbv. References issue yuval9313#192
  • Loading branch information
jgentil committed Jun 20, 2023
1 parent 1201235 commit f659871
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fastapi_restful/cbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ def _register_endpoints(router: APIRouter, cls: Type[Any], *urls: str) -> None:
prefix_length = len(router.prefix) # Until 'black' would fix an issue which causes PEP8: E203
for route in cbv_routes:
router.routes.remove(route)
# remove any tags that were previously assigned by router to route
for tag in router.tags:
try:
route.tags.remove(tag)
except ValueError:
pass
route.path = route.path[prefix_length:]
_update_cbv_route_endpoint_signature(cls, route)
cbv_router.routes.append(route)
Expand Down

0 comments on commit f659871

Please sign in to comment.