7

As far as I can tell, PlantUML auto-detects the diagram type for a given document (sequence diagram, usecase diagram, class diagram, activity diagram, etc.). This seems to work reasonably well, but I sometimes find that while editing a diagram I will make some seemingly minor change and suddenly my Activity diagram becomes a Class diagram (for example).

I would like some way to tell PlantUML what the diagram type is, and have compilation fail if the syntax isn't valid for that one chosen diagram type, but I haven't been able to find anything like this in the PlantUML documentation. Does such a diagram type identifier exist?

jbyler
  • 7,200
  • 3
  • 34
  • 42

1 Answers1

3

The simplest way is to start the diagram description with something that is specific to only one type of diagram.

E.g. if I had just the following line

A --> B
  • For a class diagram, I could add class A before it
  • For an activity diagram, I could change it to A -->[ ] B
  • For a sequence diagram, I could add participant A before it

etc.

In none of the cases is the visualization changed – I'm only adding what would be added automatically anyway.

Peter Uhnak
  • 9,617
  • 5
  • 38
  • 51
  • Why is this still making a class diagram then? ```@startuml "User" -up-> "Tenant" "Application" -up-> "Tenant" "Group" -up-> "Tenant" "Role" -up-> "Application" "User" -up-> "Group" "Registration" -up-> "User" "Registration" -up-> "Application" "User" -up-> "Role" "Entity" -up-> "Application" @enduml ``` – Richard Jul 25 '23 at 15:25