-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Minimum working example:
from dataclasses import dataclass
from typing import Literal
from dataclass_type_validator import dataclass_validate
@dataclass_validate
@dataclass
class ExampleClass:
check: Literal["success", "failure"] | None = None # Should be "success" or "failure"
a = ExampleClass("success")
b = ExampleClass("failure")
c = ExampleClass(None)
d = ExampleClass("invalid") # This passes validation even though it shouldn't
I tried strict = True, but that gives the following error:
RuntimeError: Unknown type of typing.Optional[typing.Literal['success', 'failure']] (_name = Optional)
Metadata
Metadata
Assignees
Labels
No labels