@ -1,9 +1,9 @@
import asyncio
import asyncio
import dataclasses
import dataclasses
import email . message
import email . message
import enum
import inspect
import inspect
import json
import json
from enum import Enum , IntEnum
from typing import (
from typing import (
Any ,
Any ,
Callable ,
Callable ,
@ -305,7 +305,7 @@ class APIRoute(routing.Route):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -330,7 +330,7 @@ class APIRoute(routing.Route):
openapi_extra : Optional [ Dict [ str , Any ] ] = None ,
openapi_extra : Optional [ Dict [ str , Any ] ] = None ,
) - > None :
) - > None :
# normalise enums e.g. http.HTTPStatus
# normalise enums e.g. http.HTTPStatus
if isinstance ( status_code , enum . IntEnum ) :
if isinstance ( status_code , IntEnum ) :
status_code = int ( status_code )
status_code = int ( status_code )
self . path = path
self . path = path
self . endpoint = endpoint
self . endpoint = endpoint
@ -438,7 +438,7 @@ class APIRouter(routing.Router):
self ,
self ,
* ,
* ,
prefix : str = " " ,
prefix : str = " " ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
default_response_class : Type [ Response ] = Default ( JSONResponse ) ,
default_response_class : Type [ Response ] = Default ( JSONResponse ) ,
responses : Optional [ Dict [ Union [ int , str ] , Dict [ str , Any ] ] ] = None ,
responses : Optional [ Dict [ Union [ int , str ] , Dict [ str , Any ] ] ] = None ,
@ -466,7 +466,7 @@ class APIRouter(routing.Router):
" / "
" / "
) , " A path prefix must not end with ' / ' , as the routes will start with ' / ' "
) , " A path prefix must not end with ' / ' , as the routes will start with ' / ' "
self . prefix = prefix
self . prefix = prefix
self . tags : List [ str ] = tags or [ ]
self . tags : List [ Union [ str , Enum ] ] = tags or [ ]
self . dependencies = list ( dependencies or [ ] ) or [ ]
self . dependencies = list ( dependencies or [ ] ) or [ ]
self . deprecated = deprecated
self . deprecated = deprecated
self . include_in_schema = include_in_schema
self . include_in_schema = include_in_schema
@ -483,7 +483,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -557,7 +557,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -634,7 +634,7 @@ class APIRouter(routing.Router):
router : " APIRouter " ,
router : " APIRouter " ,
* ,
* ,
prefix : str = " " ,
prefix : str = " " ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
default_response_class : Type [ Response ] = Default ( JSONResponse ) ,
default_response_class : Type [ Response ] = Default ( JSONResponse ) ,
responses : Optional [ Dict [ Union [ int , str ] , Dict [ str , Any ] ] ] = None ,
responses : Optional [ Dict [ Union [ int , str ] , Dict [ str , Any ] ] ] = None ,
@ -738,7 +738,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -790,7 +790,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -842,7 +842,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -894,7 +894,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -946,7 +946,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -998,7 +998,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -1050,7 +1050,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,
@ -1102,7 +1102,7 @@ class APIRouter(routing.Router):
* ,
* ,
response_model : Optional [ Type [ Any ] ] = None ,
response_model : Optional [ Type [ Any ] ] = None ,
status_code : Optional [ int ] = None ,
status_code : Optional [ int ] = None ,
tags : Optional [ List [ str ] ] = None ,
tags : Optional [ List [ Union [ str , Enum ] ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
dependencies : Optional [ Sequence [ params . Depends ] ] = None ,
summary : Optional [ str ] = None ,
summary : Optional [ str ] = None ,
description : Optional [ str ] = None ,
description : Optional [ str ] = None ,