Skip to content

Implied relationship don't preserve tags in scripts #293

Closed
@galuszkak

Description

@galuszkak

Description

Hi @simonbrowndotje ,

Thanks for awesome project. While working on modelling our system we encountered on a situation that our systemContext views that had implied relationships from containers are not showing up with our tags filtering. After further investigation we realized that while implied relationships are created, they aren't copying tags when using scripts.

However when you use DSL only without scripts tags are properly assigned. We are wondering why tags are copied on findRelationshipStyle. Is there any reason why this isn't part of model code? We saw issue #167 #174 that are mentioning this, but we can't quite understand why tags aren't copied when building model not when relationshipStyles are looked on...

Steps to reproduce

Code sample is provided below. To validate problem you can run it:

$ structurizr-cli validate -w test.dsl
2024-05-13T12:31:28.119+02:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

System Context Tags:
Relationship: 'Uses' tags: ''


Container Tags:
Relationship: 'Uses' tags: 'Relationship,Tag1'

Screenshot

No response

Code sample

workspace {
    !identifiers hierarchical
    model {

        softwareSystem1 = softwareSystem "Software System 1" "My software system." {
            container1 = container "WebApp"
        }
        softwareSystem2 = softwareSystem "Software System 2" "My software system." {
            container2 = container "WebApp"
        }
        softwareSystem1.container1 -> softwareSystem2.container2 "Uses" {
            tags "Tag1"
        }
    }
    views {
        systemContext softwareSystem1 "SystemContext" {
            include softwareSystem1 softwareSystem2
            !script ruby {
                puts "\nSystem Context Tags:"
                puts view.relationships.map{ |r| "Relationship: '#{r.relationship.description}' tags: '#{r.relationship.tags}'" }
                puts "\n"
            }
            autoLayout
        }
        container softwareSystem1 "containerSoftwareSystem1" {
            include softwareSystem1.container1 softwareSystem2.container2
            !script ruby {
                puts "\nContainer Tags:"
                puts view.relationships.map{ |r| "Relationship: '#{r.relationship.description}' tags: '#{r.relationship.tags}'" }
                puts "\n\n"
            }
            autoLayout
        }
    }
}

Configuration

No response

Severity

Major

Priority

I'm willing to fix this myself and raise a PR (please confirm approach first)

More information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions