|
|
@ -11,7 +11,7 @@ from fastapi.dependencies.utils import ( |
|
|
|
get_parameterless_sub_dependant, |
|
|
|
solve_dependencies, |
|
|
|
) |
|
|
|
from fastapi.encoders import jsonable_encoder |
|
|
|
from fastapi.encoders import DictIntStrAny, SetIntStr, jsonable_encoder |
|
|
|
from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError |
|
|
|
from fastapi.utils import create_cloned_field, generate_operation_id_for_path |
|
|
|
from pydantic import BaseConfig, BaseModel, Schema |
|
|
@ -38,8 +38,8 @@ def serialize_response( |
|
|
|
*, |
|
|
|
field: Field = None, |
|
|
|
response: Response, |
|
|
|
include: Set[str] = None, |
|
|
|
exclude: Set[str] = set(), |
|
|
|
include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
by_alias: bool = True, |
|
|
|
skip_defaults: bool = False, |
|
|
|
) -> Any: |
|
|
@ -53,7 +53,7 @@ def serialize_response( |
|
|
|
elif isinstance(errors_, list): |
|
|
|
errors.extend(errors_) |
|
|
|
if errors: |
|
|
|
raise ValidationError(errors) |
|
|
|
raise ValidationError(errors, field.type_) |
|
|
|
return jsonable_encoder( |
|
|
|
value, |
|
|
|
include=include, |
|
|
@ -71,8 +71,8 @@ def get_app( |
|
|
|
status_code: int = 200, |
|
|
|
response_class: Type[Response] = JSONResponse, |
|
|
|
response_field: Field = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
dependency_overrides_provider: Any = None, |
|
|
@ -195,8 +195,8 @@ class APIRoute(routing.Route): |
|
|
|
name: str = None, |
|
|
|
methods: Optional[Union[Set[str], List[str]]] = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -341,8 +341,8 @@ class APIRouter(routing.Router): |
|
|
|
deprecated: bool = None, |
|
|
|
methods: Optional[Union[Set[str], List[str]]] = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -389,8 +389,8 @@ class APIRouter(routing.Router): |
|
|
|
deprecated: bool = None, |
|
|
|
methods: List[str] = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -518,8 +518,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -563,8 +563,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -607,8 +607,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -651,8 +651,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -695,8 +695,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -739,8 +739,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -783,8 +783,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
@ -827,8 +827,8 @@ class APIRouter(routing.Router): |
|
|
|
responses: Dict[Union[int, str], Dict[str, Any]] = None, |
|
|
|
deprecated: bool = None, |
|
|
|
operation_id: str = None, |
|
|
|
response_model_include: Set[str] = None, |
|
|
|
response_model_exclude: Set[str] = set(), |
|
|
|
response_model_include: Union[SetIntStr, DictIntStrAny] = None, |
|
|
|
response_model_exclude: Union[SetIntStr, DictIntStrAny] = set(), |
|
|
|
response_model_by_alias: bool = True, |
|
|
|
response_model_skip_defaults: bool = False, |
|
|
|
include_in_schema: bool = True, |
|
|
|