Closed EiffelQ closed 3 months ago
So the issue here is that when we, added Pydantic 2.0 support, we really only allowed users to allow Redis OM Python to co-exist with pydantic 2.0 rather than actually supporting it properly, consequentially, if you are using the old examples, you need to import things like EmailStr from pydantic.v1 rather than pydantic. I've updated the README to reflect this reality.
Use case in README is following. ` import datetime from typing import Optional
from pydantic import EmailStr, ValidationError
from redis_om import HashModel
class Customer(HashModel): first_name: str last_name: str email: EmailStr join_date: datetime.date age: int bio: Optional[str]
andrew = Customer( first_name="Andrew", last_name="Brookins", email="andrew.brookins@example.com", join_date=datetime.date.today(), age=38, bio="Python developer, works at Redis, Inc." ) `
It'll response error
ValidationError: 1 validation error for Customer email instance of EmailStr expected (type=type_error.arbitrary_type; expected_arbitrary_type=EmailStr)