structurizr / dsl

Structurizr DSL
https://docs.structurizr.com/dsl
Apache License 2.0
1.41k stars 266 forks source link

implied relationships don't inherit tags? #286

Closed chrikoch closed 1 year ago

chrikoch commented 1 year ago

Description

I'm using structurizr DSL and some kotlin scripts for my model. While checking some relations via kotlin I ran into the problem, that implied relationships obviously don't inherit the tags from the original relationship. I wonder whether this is desired behavior.

This is a minimal example:

workspace {
  model {
    s1 = softwareSystem "S1" {
      c1 = container "C1"
    }
    s2 = softwareSystem "S2" {
      c2 = container "C2"
    }

    c1 -> c2 "desc" "tech" "myTag"
  }

  !script test.kts
}

test.kts has the following contents:

val rels = workspace.getModel().getRelationships()

for (r in rels) {
  println("from " + r.getSource() + " to " + r.getDestination() + " tags: " + r.getTags())
}

Output is

from {2 | C1 | } to {4 | C2 | } tags: Relationship,myTag
from {1 | S1 | } to {4 | C2 | } tags:
from {2 | C1 | } to {3 | S2 | } tags:
from {1 | S1 | } to {3 | S2 | } tags:

Only the "real" relation C1->C2 has the tags, the others don't have them.

Is there any way to check via kotlin whether a relationship is an implied one?

Background: I'm trying to implement some sort of "Unit-Test" via kotlin script to ensure all relationships have the correct tags.

Steps to reproduce

see above

Screenshot

No response

Code sample

No response

Configuration

No response

Severity

Minor

Priority

Low

Resolution

I have no budget, please fix this for free

More information

No response

chrikoch commented 1 year ago

Is there any way to check via kotlin whether a relationship is an implied one?

An option might be to check whether the tag "Relationship" exists, but I wonder whether this is reliable.