diff --git a/fastapi/routing.py b/fastapi/routing.py index 3e6a972964..d60af8adcc 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -1773,7 +1773,9 @@ class APIRouter(routing.Router): deprecated=( route.deprecated if route.deprecated is not None - else self.deprecated if deprecated is None else deprecated + else self.deprecated + if deprecated is None + else deprecated ), methods=route.methods, operation_id=route.operation_id,