TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.13k stars 284 forks source link

Add support for packages and components in puml files #1321

Open uhafner opened 1 month ago

uhafner commented 1 month ago

It makes sense to use packages or components as the items that define the allowed dependencies that are checked with the adhereToPlantUmlDiagram method (see documentation).

This PR changes the allowed syntax so that the following examples are valid input definitions for adhereToPlantUmlDiagram:

@startuml
component "Web API" <<..web>> as web
component "Use Cases" <<..usecase>> as usecase
component "Persistence" <<..persistence>> as persistence

web --> usecase
usecase --> persistence
@enduml

components-long-syntax

@startuml
package "Web API" <<..web>> as web
package "Use Cases" <<..usecase>> as usecase
package "Persistence" <<..persistence>> as persistence

web --> usecase
usecase --> persistence
@enduml

packages-long-syntax

Note: to keep the regexp simple, the format component name without quotation marks is not supported yet, so you always need to specify the name as component "name"