-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Pydantic V2 models #16
Comments
Hello, |
Hi,
Currently, we are using Pydantic v2's backward compatibility of v1: Lines 8 to 11 in b7b8938
The goal here is to implement the Pydantic models using Pydantic v2 but still compatible with v1. A first idea (inspired by FastAPI) but not tested could be something like (code is an example): from pydantic import BaseModel
from pydantic.version import VERSION
PYDANTIC_V1: bool = VERSION.startswith("1.")
if PYDANTIC_V1:
class MyModel(BaseModel):
attr_1: str
class Config:
extra = "allow"
else:
from pydantic import ConfigDict
class MyModel(BaseModel):
attr_1: str
model_config = ConfigDict(extra="allow") |
Hello, thanks for explaining |
Hi @roman2git, |
Hi @develop-cs |
@develop-cs |
Hi @develop-cs , please, have a look at #37 Just a note: |
Is your feature request related to a problem? Please describe
Use Pydantic V2
BaseModel
class rather than V1 (maintenance purpose only).Describe the solution you'd like
Migrate referring the Pydantic V2 Migration Guide.
Describe alternatives you've considered
Use Pydantic V2/V1 backward compatibility:
The text was updated successfully, but these errors were encountered: