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

aredis_om and pydantic-v2 @model_validator RecursionError #583

Closed
brodyreiss1 opened this issue Jan 4, 2024 · 1 comment · Fixed by #603
Closed

aredis_om and pydantic-v2 @model_validator RecursionError #583

brodyreiss1 opened this issue Jan 4, 2024 · 1 comment · Fixed by #603

Comments

@brodyreiss1
Copy link

When trying to add a pydantic v2 model validator to my aredis_om JsonModel, a RecursionError occurs. When testing both aredis_om and the validator separately, both work without error. When testing together a maximum depth search error occurs.

Here is example code that recreates this issue...

from aredis_om import JsonModel
from pydantic import model_validator


class Test(JsonModel):
    name: str

    @model_validator(mode='after')
    async def create_name(self):
        self.name = 'this is different'
        return self

    @classmethod
    async def create(cls, name):
        test = cls(name=name)
        await test.save()
@slorello89
Copy link
Member

I think this will probably be solved by #603

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

Successfully merging a pull request may close this issue.

2 participants