🐛 Fix mypy route errors after merging #415 (#462)

This commit is contained in:
Sebastián Ramírez 2019-08-24 20:05:44 -05:00 committed by GitHub
parent f7f17fcfd6
commit e71636e381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -449,9 +449,11 @@ class APIRouter(routing.Router):
), "A path prefix must not end with '/', as the routes will start with '/'"
else:
for r in router.routes:
if not r.path:
path = getattr(r, "path")
name = getattr(r, "name", "unknown")
if path is not None and not path:
raise Exception(
f"Prefix and path cannot be both empty (operation: {r.name})"
f"Prefix and path cannot be both empty (path operation: {name})"
)
if responses is None:
responses = {}