java icon indicating copy to clipboard operation
java copied to clipboard

Group participants by parent in plantuml structurizr seq diagrams

Open Leooo opened this issue 6 months ago • 2 comments

It is quite hard currently to understand large sequence diagrams created using Structurizr, as the participants are not grouped by parent.

This PR is starting to resolve this. It may also be a first step towards adding more advanced sequence diagram features relevant to C4 in the future, e.g. allowing to collapse or expand sequence diagram participants using element parents.

  • [x] group components in Plantuml structurizr sequence diagrams by parent containers and by grand-parent software systems.

  • [x] group containers in Plantuml structurizr sequence diagrams by parent software systems.

  • [x] group elements in Plantuml structurizr sequence diagrams by parent groups.

  • [x] add plantuml.teoz property to allow nested boxes in sequence diagrams - see teoz layout engine details here

  • [x] styling of parent and grand-parents on sequence diagrams uses what is defined in styles object

First example (components grouped by containers then softwareSystem):

After changes in this PR - the elements with the same parent (f, g and h) are now grouped while they were not before. Both parent and grand-parent elements are shown. Any group is also shown

Screenshot 2025-10-04 at 15 24 24

Second example (containers grouped by software systems):

After changes in this PR - the parents Software Systems of the container participants are shown:

Screenshot 2025-10-02 at 11 20 21

Third example

After changes - elements belonging to the same container are grouped:

Screenshot 2025-09-26 at 14 38 07 Screenshot 2025-09-26 at 14 48 00

Possible extensions / improvements to this PR - to be discussed

  • add the changes proposed in this PR under a property flag to be backward compatible.
  • ensure that, inside a given parent box, the order of steps mirrors the order they were declared (in the first example above the participant f is not the first anymore).

Leooo avatar Jun 29 '25 19:06 Leooo