py2puml fails to inspect a dataclass using Optional as follows:
from dataclasses import dataclass
from typing import Optional
@dataclass
class MyData:
data: Optional[bool]
ValueError: Could not resolve type typing.Union in module <module 'tests.modules.withoptional' from '.../py2puml/tests/modules/withoptional.py'>: it needs to be imported explicitly.
It is because Optional[bool] is dynamically converted into Union[bool, None] without adding both typing.Union and typing.Nonetype in the module wrapped by the ModuleResolver.
py2puml fails to inspect a dataclass using
Optional
as follows:It is because
Optional[bool]
is dynamically converted intoUnion[bool, None]
without adding bothtyping.Union
andtyping.Nonetype
in the module wrapped by the ModuleResolver.