empty alt group syntax error

0 votes
asked Sep 24, 2021 in Question / help by Krutcha (120 points)
Hi, I am running into a problem in some auto generated plantUML sequence diagrams.  Specifically in some cases a sequence with no messages can exist.  However a structure of groups etc may exist.  

Is there.a way to render:

@startuml
alt a
end
@enduml

will create a syntax error (on the line where the alt box is created), while

@startuml
group a
end
@enduml

renders fine.  Even if I create a large diagrams with many nested groups and 1 alt group, this syntax error occurs unless, somewhere, anywhere, in the diagram, an arrow occurs.

1 Answer

0 votes
answered Sep 24, 2021 by The-Lu (37,800 points)
selected Sep 24, 2021 by Krutcha
 
Best answer

Hello K.,

unless, somewhere, anywhere, in the diagram, an arrow occurs.

But a Sequence diagram without arrow... is not a Sequence diagram...wink

Then here are some examples of Sequence diagram:

  • alt
@startuml
' Add a participant in order to force to be a Sequence diagram
participant p

alt a
end
@enduml

  • group
@startuml
' Add a participant in order to force to be a Sequence diagram
participant p

group a
end
@enduml

Because this example is a Activity diagram:

@startuml
' Without participant this is a Activity diagram
'participant p

group a
end
@enduml

If that can help,
Regards,
Th.

commented Sep 24, 2021 by Krutcha (120 points)
Thanks that helps a lot, I was mostly confused by 'group' and 'alt' or 'opt' behaving differently there, but I can force a participant even if there are no messages to prevent the error, so that works for me :)
...