Skip to content

Commit 403e26f

Browse files
committed
➖ Drop support for Pydantic v1
1 parent 53bb39a commit 403e26f

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/fastapi_cli/config.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
from typing import Any, Dict, Optional
44

55
from pydantic import BaseModel, StrictStr
6-
from pydantic.version import VERSION as PYDANTIC_VERSION
76

87
logger = logging.getLogger(__name__)
98

10-
PYDANTIC_VERSION_MINOR_TUPLE = tuple(int(x) for x in PYDANTIC_VERSION.split(".")[:2])
11-
PYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE[0] == 2
12-
139

1410
class FastAPIConfig(BaseModel):
1511
entrypoint: Optional[StrictStr] = None
@@ -43,8 +39,4 @@ def resolve(cls, entrypoint: Optional[str] = None) -> "FastAPIConfig":
4339
if entrypoint is not None:
4440
config["entrypoint"] = entrypoint
4541

46-
# Pydantic v2 uses model_validate, v1 uses parse_obj
47-
if not PYDANTIC_V2:
48-
return cls.parse_obj(config) # type: ignore[no-any-return, unused-ignore]
49-
50-
return cls.model_validate(config) # type: ignore[no-any-return, unused-ignore, attr-defined]
42+
return cls.model_validate(config)

0 commit comments

Comments
 (0)