mirror of https://github.com/tiangolo/fastapi.git
Fix types
This commit is contained in:
parent
a0f72eec31
commit
304b55d658
|
|
@ -2186,6 +2186,7 @@ class FastAPI(Starlette):
|
||||||
"""
|
"""
|
||||||
return self.router.put(
|
return self.router.put(
|
||||||
path,
|
path,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -2208,7 +2209,6 @@ class FastAPI(Starlette):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -2567,6 +2567,7 @@ class FastAPI(Starlette):
|
||||||
"""
|
"""
|
||||||
return self.router.post(
|
return self.router.post(
|
||||||
path,
|
path,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -2589,7 +2590,6 @@ class FastAPI(Starlette):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -2943,6 +2943,7 @@ class FastAPI(Starlette):
|
||||||
"""
|
"""
|
||||||
return self.router.delete(
|
return self.router.delete(
|
||||||
path,
|
path,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -2965,7 +2966,6 @@ class FastAPI(Starlette):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -3733,6 +3733,7 @@ class FastAPI(Starlette):
|
||||||
"""
|
"""
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
*args: Any,
|
||||||
response_model: Annotated[
|
response_model: Annotated[
|
||||||
Any,
|
Any,
|
||||||
Doc(
|
Doc(
|
||||||
|
|
@ -4051,7 +4052,6 @@ class FastAPI(Starlette):
|
||||||
"""
|
"""
|
||||||
),
|
),
|
||||||
] = Default(generate_unique_id),
|
] = Default(generate_unique_id),
|
||||||
# *args,
|
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> Callable[[DecoratedCallable], DecoratedCallable]:
|
) -> Callable[[DecoratedCallable], DecoratedCallable]:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -962,6 +962,7 @@ class APIRouter(routing.Router):
|
||||||
self.add_api_route(
|
self.add_api_route(
|
||||||
path,
|
path,
|
||||||
func,
|
func,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -985,7 +986,6 @@ class APIRouter(routing.Router):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
return func
|
return func
|
||||||
|
|
@ -1273,6 +1273,7 @@ class APIRouter(routing.Router):
|
||||||
self.add_api_route(
|
self.add_api_route(
|
||||||
prefix + route.path,
|
prefix + route.path,
|
||||||
route.endpoint,
|
route.endpoint,
|
||||||
|
*args,
|
||||||
response_model=route.response_model,
|
response_model=route.response_model,
|
||||||
status_code=route.status_code,
|
status_code=route.status_code,
|
||||||
tags=current_tags,
|
tags=current_tags,
|
||||||
|
|
@ -1299,7 +1300,6 @@ class APIRouter(routing.Router):
|
||||||
callbacks=current_callbacks,
|
callbacks=current_callbacks,
|
||||||
openapi_extra=route.openapi_extra,
|
openapi_extra=route.openapi_extra,
|
||||||
generate_unique_id_function=current_generate_unique_id,
|
generate_unique_id_function=current_generate_unique_id,
|
||||||
*args,
|
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
elif isinstance(route, routing.Route):
|
elif isinstance(route, routing.Route):
|
||||||
|
|
@ -1685,6 +1685,7 @@ class APIRouter(routing.Router):
|
||||||
"""
|
"""
|
||||||
return self.api_route(
|
return self.api_route(
|
||||||
path,
|
path,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -1708,7 +1709,6 @@ class APIRouter(routing.Router):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -2070,6 +2070,7 @@ class APIRouter(routing.Router):
|
||||||
"""
|
"""
|
||||||
return self.api_route(
|
return self.api_route(
|
||||||
path,
|
path,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -2093,7 +2094,6 @@ class APIRouter(routing.Router):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -2455,6 +2455,7 @@ class APIRouter(routing.Router):
|
||||||
"""
|
"""
|
||||||
return self.api_route(
|
return self.api_route(
|
||||||
path,
|
path,
|
||||||
|
*args,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
status_code=status_code,
|
status_code=status_code,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|
@ -2478,7 +2479,6 @@ class APIRouter(routing.Router):
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
openapi_extra=openapi_extra,
|
openapi_extra=openapi_extra,
|
||||||
generate_unique_id_function=generate_unique_id_function,
|
generate_unique_id_function=generate_unique_id_function,
|
||||||
*args,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from fastapi import APIRouter, FastAPI
|
from fastapi import APIRouter, FastAPI
|
||||||
|
|
||||||
method_names = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('method_name', ["get", "put", "post", "delete", "options", "head", "patch", "trace"])
|
@pytest.mark.parametrize('method_name', ["get", "put", "post", "delete", "options", "head", "patch", "trace"])
|
||||||
@pytest.mark.parametrize('sig_param', inspect.signature(APIRouter.get).parameters.items())
|
@pytest.mark.parametrize('sig_param', inspect.signature(APIRouter.get).parameters.items())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue