Skip to content

Custom objects as datatypes #7653

Open
Open
@WilliamMiteff

Description

@WilliamMiteff

Current problem

No UML object is shown for relationships that are in generics like list or dictionary.

Desired solution

When the UML is built, it should show the class that is referenced in the generic.

Additional context

This code shows that the class diagram that gets built shows the relationship between classes a and b but it doesn't show that there is any relationship between c and b.

# save as test.py
class a():
    x: str = ''

class b():
    y: a = a()

class c():
    z: list[b] = [b()]
    z.append(b())

As a side note, I had to set the variable y in class b to a() for the relationship to show up, it wasn't automatic even with defining it as the type.

commands to test pyreverse

pyreverse -c a test.py -f ALL -ASmy
pyreverse -c b test.py -f ALL -ASmy
pyreverse -c c test.py -f ALL -ASmy
pyreverse test.py -f ALL -ASmy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentNeeds specification 🔐Accepted as a potential improvement, and needs to specify edge cases, message names, etc.pyreverseRelated to pyreverse component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions