Preamble
Anonymous dict payloads make stack traces opaque: which keys exist? which are optional? dataclasses and typing.NamedTuple document shape at low cost—similar spirit to Java records (Java Records for DTOs and Immutable Carriers) before frameworks enter the room.
dataclasses: mutable, feature-rich
@dataclass gives defaults, __post_init__, and optional methods. Good when objects evolve during a pipeline stage.
NamedTuple: immutable, tuple-like
NamedTuple emphasizes immutability and unpacking. Hashable when fields are hashable—useful as keys or set members when appropriate.
Stack traces and APIs
Named fields beat KeyError: 'emial' typos in large JSON blobs. Both improve debuggability compared to raw dicts passed through ten layers.
Evolution to pydantic
When validation, coercion, and schema evolution become non-negotiable, pydantic (or similar) earns its dependency weight. Until then, stdlib models stay lean.
Conclusion
Pick mutation vs immutability honestly. A Minimal Spring Boot Service: Endpoints and Configuration wires a minimal Spring Boot service with DI as composition root.