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

docs: Fix "Use of stdlib dataclasses with BaseModel" bug #8491

Merged
merged 3 commits into from Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/concepts/dataclasses.md
Expand Up @@ -250,7 +250,7 @@ import dataclasses
from datetime import datetime
from typing import Optional

from pydantic import BaseModel, ValidationError
from pydantic import BaseModel, ConfigDict, ValidationError


@dataclasses.dataclass(frozen=True)
Expand All @@ -265,6 +265,9 @@ class File:


class Foo(BaseModel):
# Required so that pydantic revalidates the model attributes
model_config = ConfigDict(revalidate_instances='always')

file: File
user: Optional[User] = None

Expand Down