lucsorel / py2puml

Generate PlantUML class diagrams to document your Python application.
https://pypi.org/project/py2puml/
MIT License
217 stars 35 forks source link

use class member arrows to start relationship between a class field of a type and its type UML class #107

Open lucsorel opened 3 months ago

lucsorel commented 3 months ago

#3636 Arrows from/to class fields

Right now, PlantUML would describe the composition relationship between a person and its address like this (an arrow between the 2 classes):

@startuml
class Address {
 street: str
 zipcode: str
 city: str
}

class Person {
 name: str
 address: Address
}

Person -> Address
@enduml

But it would be interesting to have the relationship starting from the Person.address field:

@startuml
class Address {
 street: str
 zipcode: str
 city: str
}

class Person {
 name: str
 address: Address
}

Person::address -> Address
@enduml

Although the rendering is not so relevant on this example.

Caution:

  1. what behavior do we want when several fields of a class link to the same class? One specific line per field? One general line between the 2 classes? Readability matters.