[packages]
starlette = "==0.12.7"
-pydantic = "==0.30.0"
+pydantic = "==0.32.2"
databases = {extras = ["sqlite"],version = "*"}
hypercorn = "*"
-from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Type, Union
+from typing import Any, Callable, Dict, List, Optional, Sequence, Type, Union
from fastapi import routing
+from fastapi.encoders import DictIntStrAny, SetIntStr
from fastapi.exception_handlers import (
http_exception_handler,
request_validation_exception_handler,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
from enum import Enum
from types import GeneratorType
-from typing import Any, List, Set
+from typing import Any, Dict, List, Set, Union
from pydantic import BaseModel
from pydantic.json import ENCODERS_BY_TYPE
+SetIntStr = Set[Union[int, str]]
+DictIntStrAny = Dict[Union[int, str], Any]
+
def jsonable_encoder(
obj: Any,
- 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,
include_none: bool = True,
-from typing import Any
+from typing import Any, Sequence
from pydantic import ValidationError
+from pydantic.error_wrappers import ErrorList
+from requests import Request
from starlette.exceptions import HTTPException as StarletteHTTPException
+from starlette.websockets import WebSocket
class HTTPException(StarletteHTTPException):
class RequestValidationError(ValidationError):
- pass
+ def __init__(self, errors: Sequence[ErrorList]) -> None:
+ super().__init__(errors, Request)
class WebSocketRequestValidationError(ValidationError):
- pass
+ def __init__(self, errors: Sequence[ErrorList]) -> None:
+ super().__init__(errors, WebSocket)
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
*,
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:
elif isinstance(errors_, list):
errors.extend(errors_)
if errors:
- raise ValidationError(errors)
+ raise ValidationError(errors, field.type_)
return jsonable_encoder(
value,
include=include,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
]
requires = [
"starlette >=0.11.1,<=0.12.7",
- "pydantic >=0.30,<=0.30.0"
+ "pydantic >=0.32.2,<=0.32.2"
]
description-file = "README.md"
requires-python = ">=3.6"
response = client.get("/items/foo")
assert response.status_code == 400
validation_error_str_lines = [
- b"1 validation error",
+ b"1 validation error for Request",
b"path -> item_id",
b" value is not a valid integer (type=type_error.integer)",
]
{
"detail": [
{
+ "ctx": {"enum_values": ["alexnet", "resnet", "lenet"]},
"loc": ["path", "model_name"],
- "msg": "value is not a valid enumeration member",
+ "msg": "value is not a valid enumeration member; permitted: 'alexnet', 'resnet', 'lenet'",
"type": "type_error.enum",
}
]