pre-commit-ci-lite[bot]
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
3 additions and
6 deletions
-
fastapi/routing.py
-
tests/test_route_deferred_init.py
|
|
|
@ -656,8 +656,8 @@ class APIRoute(routing.Route): |
|
|
|
) |
|
|
|
|
|
|
|
@cached_property |
|
|
|
def response_fields(self) -> dict[int| str, ModelField]: |
|
|
|
response_fields: dict[int| str, ModelField] = {} |
|
|
|
def response_fields(self) -> dict[int | str, ModelField]: |
|
|
|
response_fields: dict[int | str, ModelField] = {} |
|
|
|
for additional_status_code, response in self.responses.items(): |
|
|
|
assert isinstance(response, dict), "An additional response must be a dict" |
|
|
|
model = response.get("model") |
|
|
|
|
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
from itertools import chain |
|
|
|
from typing import Optional |
|
|
|
|
|
|
|
from fastapi import APIRouter, Depends, FastAPI |
|
|
|
from fastapi.routing import APIRoute |
|
|
|
@ -26,9 +25,7 @@ def check_if_initialized(route: APIRoute, should_not: bool = False): |
|
|
|
assert key in route.__dict__ |
|
|
|
|
|
|
|
|
|
|
|
def create_test_router( |
|
|
|
routes: Optional[list[BaseRoute]] = None, defer_init: bool = True |
|
|
|
): |
|
|
|
def create_test_router(routes: list[BaseRoute] | None = None, defer_init: bool = True): |
|
|
|
router = APIRouter(routes=routes or [], defer_init=defer_init) |
|
|
|
|
|
|
|
class UserIdBody(BaseModel): |
|
|
|
|