Skip to content

Commit

Permalink
docs: Fix "Use of stdlib dataclasses with BaseModel" bug (#8491)
Browse files Browse the repository at this point in the history
Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
  • Loading branch information
patelnets and sydney-runkle committed Jan 5, 2024
1 parent 8878eaa commit 43806f5
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 43806f5

Please sign in to comment.