|
@ -21,12 +21,10 @@ from typing import ( |
|
|
from fastapi.exceptions import RequestErrorModel |
|
|
from fastapi.exceptions import RequestErrorModel |
|
|
from fastapi.types import IncEx, ModelNameMap, UnionType |
|
|
from fastapi.types import IncEx, ModelNameMap, UnionType |
|
|
from pydantic import BaseModel, create_model |
|
|
from pydantic import BaseModel, create_model |
|
|
from pydantic.version import VERSION as P_VERSION |
|
|
from pydantic.version import VERSION as PYDANTIC_VERSION |
|
|
from starlette.datastructures import UploadFile |
|
|
from starlette.datastructures import UploadFile |
|
|
from typing_extensions import Annotated, Literal, get_args, get_origin |
|
|
from typing_extensions import Annotated, Literal, get_args, get_origin |
|
|
|
|
|
|
|
|
# Reassign variable to make it reexported for mypy |
|
|
|
|
|
PYDANTIC_VERSION = P_VERSION |
|
|
|
|
|
PYDANTIC_VERSION_MINOR_TUPLE = tuple(int(x) for x in PYDANTIC_VERSION.split(".")[:2]) |
|
|
PYDANTIC_VERSION_MINOR_TUPLE = tuple(int(x) for x in PYDANTIC_VERSION.split(".")[:2]) |
|
|
PYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE[0] == 2 |
|
|
PYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE[0] == 2 |
|
|
|
|
|
|
|
@ -47,6 +45,8 @@ sequence_annotation_to_type = { |
|
|
|
|
|
|
|
|
sequence_types = tuple(sequence_annotation_to_type.keys()) |
|
|
sequence_types = tuple(sequence_annotation_to_type.keys()) |
|
|
|
|
|
|
|
|
|
|
|
Url: Type[Any] |
|
|
|
|
|
|
|
|
if PYDANTIC_V2: |
|
|
if PYDANTIC_V2: |
|
|
from pydantic import PydanticSchemaGenerationError as PydanticSchemaGenerationError |
|
|
from pydantic import PydanticSchemaGenerationError as PydanticSchemaGenerationError |
|
|
from pydantic import TypeAdapter |
|
|
from pydantic import TypeAdapter |
|
|