Skip to content
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

Pydantic V1 style @validator validators are deprecated #609

Closed
woutdenolf opened this issue May 3, 2024 · 2 comments
Closed

Pydantic V1 style @validator validators are deprecated #609

woutdenolf opened this issue May 3, 2024 · 2 comments

Comments

@woutdenolf
Copy link

woutdenolf commented May 3, 2024

Python            3.9.18
pydantic          2.7.1
pydantic_core     2.18.2
redis-om          0.3.0

Reproduce

 python -W error -c "import redis_om"

Deprecation warning

/usr/local/lib/python3.9/site-packages/redis_om/__init__.py:4: in <module>
    from .model.migrations.migrator import MigrationError, Migrator
/usr/local/lib/python3.9/site-packages/redis_om/model/__init__.py:2: in <module>
    from .model import (
/usr/local/lib/python3.9/site-packages/redis_om/model/model.py:1370: in <module>
    class RedisModel(BaseModel, abc.ABC, metaclass=ModelMeta):
/usr/local/lib/python3.9/site-packages/redis_om/model/model.py:1430: in RedisModel
    @validator("pk", always=True, allow_reuse=True)
/usr/local/lib/python3.9/site-packages/pydantic/deprecated/class_validators.py:118: in validator
    warn(
E   pydantic.warnings.PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/
@slorello89
Copy link
Member

Hi @woutdenolf - this behavior is to be expected, 0.3.0 moved Redis OM Python from using only v1 style validators to using v2 style pydantic when v2 is present, and v1 style pydantic when v1 is present, see my note here: #603 (comment)

@slorello89
Copy link
Member

Going to close this out as it's expected behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants