With frozen dataclasses we have something which resembles immutability. But when creating one such instance, I want to be sure that the init data is actually valid. Example:
from dataclasses import dataclass, field
import datetime
@dataclass(frozen=True)
class Employee:
employeeId: str # should never be None
name: str # should never be None or empty
dateOfBirth: datetime.date # could be None if unknown
Is there a way to specify these conditions (probably through annotations) so that we get a ValueError
if the condition is not met?