plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.66k stars 878 forks source link

elseif and switch in activity diagram (beta) do not honour conditionStyle skinparam #1714

Open jwrightecs opened 1 month ago

jwrightecs commented 1 month ago

Is your feature request related to a problem? Please describe. The skinparam conditionStyle allows the setting of conditional style (where to put the condition, whether to use a diamond) in activity diagrams. This works in if, while and repeat, but breaks for elseif and doesn't work for switch

Describe the solution you'd like The decision point <> should respect the specified conditionStyle skinparam

Describe alternatives you've considered both if...elseif..else..endif and switch...case...endswitch can be represented by a switch with an unlabeled condition, (with possible preceding labeled arrow) which appears ok; if...elseif...endif can be made out of if...else if ... endif...endif which is equivalent in meaning, but creates a lot of unnecessary nesting in the diagram

Additional context switch example what i try

@startuml
skinparam conditionStyle diamond
start
switch (test?)
case ( condition A )
  :Text 1;
case ( condition B ) 
  :Text 2;
case ( condition C )
  :Text 3;
case ( condition D )
  :Text 4;
case ( condition E )
  :Text 5;
endswitch
stop
@enduml

what I would expect

@startuml
start
-> test?;
switch ()
case ( condition A )
  :Text 1;
case ( condition B ) 
  :Text 2;
case ( condition C )
  :Text 3;
case ( condition D )
  :Text 4;
case ( condition E )
  :Text 5;
endswitch
stop
@enduml

if...elseif example what i was expecting

@startuml
skinparam conditionStyle diamond
start
switch ()
case (condition A)
  :Text 1;
case (condition B)
  :Text 2;
  stop
case (condition C)
  :Text 3;
case (condition D)
  :Text 4;
case ()
  :Text else;
endswitch
stop
@enduml

what i get

@startuml
start
if (condition A) then (yes)
  :Text 1;
elseif (condition B) then (yes)
  :Text 2;
  stop
(no) elseif (condition C) then (yes)
  :Text 3;
(no) elseif (condition D) then (yes)
  :Text 4;
else (nothing)
  :Text else;
endif
stop
@enduml