Open Greven145 opened 4 years ago
I have tried to implement namespace support.
https://github.com/shiena/PlantUmlClassDiagramGenerator/tree/support-namespace
It works to some extent, but I can't convert the fully qualified type names of the parent class/interface and fields well.
For example, if you convert the following classes
class C0 {}
namespace N1
{
class C1
{
class C2 : C0
{
C0 field = new C0();
}
}
}
This is the expected output.
@startuml
class C0 {
}
class "C1" as N1.C1 {
}
class "C2" as N1.C1+C2 {
field : C0
}
C0 <|-- "N1.C1+C2"
N1.C1 +-- "N1.C1+C2"
@enduml
But this is the actual output.
@startuml
class C0 {
}
class "C1" as N1.C1 {
}
class "C2" as N1.C1+C2 {
'The fully qualified type name of the field is wrong
field : N1.C1+C0
}
'The fully qualified type name of the parent class is wrong
"N1.C1+C0" <|-- "N1.C1+C2"
N1.C1 +-- "N1.C1+C2"
@enduml
This is because we don't know the name of the fully qualified type of the using class because it is parsed by syntax tree. It may be possible to solve this problem by parsing with a semantic model.
FWIW; if you !include
a sub diagram inside a namespace
clause, it will assign the imported classes to that namespace.
Example:
namespace MyNamespace {
!include Project/Folder/MyClass.puml
}
I've used it with some success to have the class diagram generator generate all classes (e.g. puml-gen . plantuml/ -dir
) and then manually create the diagrams by explicitly including the classes I want in that diagram.
Love the tool! I have a feature request that would make my workflow much easier.
I would like to see a flag added that would include the namespace for any class and reference to the output.
For example, instead of:
I would prefer: