Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support optional typing #50

Open
lucsorel opened this issue Aug 4, 2023 · 1 comment
Open

support optional typing #50

lucsorel opened this issue Aug 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@lucsorel
Copy link
Owner

lucsorel commented Aug 4, 2023

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.

@lucsorel lucsorel added the enhancement New feature or request label Aug 4, 2023
@lucsorel
Copy link
Owner Author

lucsorel commented Aug 4, 2023

This issue was first revealed in #45 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant