PY-MODE0005 · standard_dataclass_model
Replace state-bearing standard dataclasses with the approved model foundation.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Report a Python class decorated with the standard dataclass decorator when it declares at
least one field and no ordinary behavior. Such a class is already a data model, so the project
foundation should own validation, serialization, immutability, and schema policy consistently.
Evidence
Section titled “Evidence”Each finding names the dataclass and its field count. The value is the number of declarative dataclasses in the file.
Exceptions
Section titled “Exceptions”A class whose identity is a language interop record or whose methods implement ordinary behavior can remain a dataclass through a path exclusion. Empty marker classes are handled by the separate nonempty-model rule.
Examples
Section titled “Examples”@dataclass class Point with x and y fields is reported. class Point(FrozenModel) is the
accepted project model shape.
References
Section titled “References”- Cites “Pydantic documentation”, models. Open reference
- Cites “The Python Standard Library”, dataclasses. Open reference