Package style is confused by several stereotypes

0 votes
asked Sep 28, 2016 in bug by JohannesMeier (980 points)

Hello,

using the package style alone works fine, but if one adds another stereotype, the package style will be ignored and treated as another stereotype:

 

@startuml
package foo1 <<Node>> {
  class Class1
}

package foo2 <<A>><<B>> {
  class Class2
}

package foo3 <<Foo>><<Node>><<Bar>> {
  class Class3
}
@enduml

 

http://plantuml.com/plantuml/uml/AqXCpavCJrL8oyytLB2nySjFIRMpKwZcKb18paaiBbPm1f66NBLSN0K8bKP0bOvsTZOsJfXgZT3K6WFLkkNdWrH330VgIYp2r6VCLGi0

I assume, the bug appeared because of the same syntax of package style and stereotypes...

1 Answer

+1 vote
answered Sep 29, 2016 by plantuml (138,660 points)
selected Jan 11 by JohannesMeier
 
Best answer

Ok, this one is more complex.

The real issue comes from the fact that PlantUML language has been defined in a continuous and experimental way, and that leads sometimes to some inconsistency. Now I think it’s time to set it clearly.

At the beginning, there were only classes and packages.

Then, at some moment, we have added new package styles (node, folder...) and at that time, the best option, was to use UML stereotype. So in classes diagram can have:

package foo <<node>> {
  class bar
}


Now that we are starting to implement deployment diagram http://plantuml.com/deployment-diagram , it sounds more logical to use specific keywords (node, folder...) rather than stereotypes. So you can write:

node foo {
  artifact bar
}


Even if you cannot (yet) mix class diagram and deployment diagram, large portion of internal PlantUML code are common between both diagram types (and that drives to strange behaviour, as you have noticed).

I am wondering if we should not change the syntax for classes diagram, remove the ability to change style of package through stereotype, and let the new syntax be:

node foo {
  class bar
}


This is not mandatory (we could fix your issue without doing this) but maybe situation will be more simple for users that way.
One drawback is that this somehow breaks ascending compatibility (newer version of PlantUML would not apply styles on "old" diagrams that uses stereotypes). It may be acceptable, as diagrams will still be displayed (and style, even if not applied, would be displayed as Stereotype).

We are still thinking about all this, so any idea/suggestion is welcome!

commented Sep 29, 2016 by JohannesMeier (980 points)
From my point of view, changing the syntax for class diagrams is the more consistent way and simplifies the syntax.
Using "frame", "cloud", and so on increases the consistency between the different kinds of diagrams, too.

Currently, I am not able to foresee all the impacts of changing the syntax, in particular regarding the ascending compatibility...
commented Sep 30, 2016 by Serge Wenger Work (6,820 points)
Sometimes (but not too often), some breaking changes are mandatory to add new functionalities.
For "deployement diagram", the node type "file" is missing (folder is existing)
commented Sep 30, 2016 by plantuml (138,660 points)
Yes, we will probably go this way (as it does not completely break the compatibility).
However, we need time here.

About "file", this is a good idea. Thanks!
So here is a beta
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

that supports:
@startuml
folder folder
file file
file {
  artifact artifact1
  artifact artifact2
}
file MyFile {
  artifact artifact3
  artifact artifact4
}
file MyOtherFile [
  Simple text
  ====
  Other text
]
@enduml

As usually, very few tests have been done, so tell if it's not working for you.
commented Sep 30, 2016 by Serge Wenger Work (6,820 points)
Thanks, it is OK for me
commented Jan 11 by JohannesMeier (980 points)
Thanks for your effort!

I tried it and it works for me:
http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIf8JCvEJ4zLIClFDrImiV7BJqcrirEevb9GICv9B2vMS0QHXborNCWgZO0g7UtiR6oSCDKQeQar1gfroyy7gOOO3jILM8IfpnYaBm-e0gJ91BzJOCfC2Ra3fj2C14SufEQb04C60000

But for foo6, the rendering of the second stereotype looks a bit weird. Maybe, it is another bug.
commented Jan 11 by plantuml (138,660 points)
This is indeed another bug : PlantUML gets confuse because Class3 appears in both foo3 and foo6
We're going to investigate arround this.
Thanks!
...