Skip to content

Group name not respected when defining a relationship with !identifiers hierarchical #30

Open
@dpmjansen

Description

@dpmjansen

Expected

Hi, I'm experimenting a bit with structurizr and ran into a (possible) bug when trying to reference an element within a group when !identifiers hierarchical is enabled in the workspace. The group name is ignored when trying to add a relationship, an error is thrown. It does seem possible to reference to or from an element within a group by using its direct name, but then the hierarchy is no longer fully adhered. Again, I'm not sure if this is a bug or if this is intended, but I'd thought I'd submit it anyway.

Given/When/Then scenario

Given !identifiers hierarchical is set on a workspace
And I define a group with containers in it
And I define a container outside of the group
When I reference a relationship to an element within that group
Then I expect that the group name needs to be used in the reference

Actual

An error is thrown:

The source element "ss.a_group.service" does not exist at line 14: ss.a_group.service -> b_container "Calls"

com.structurizr.dsl.StructurizrDslParserException: The source element "ss.a_group.service" does not exist at line ... of example.dsl: ss.a_group.service -> b_container

Steps to reproduce

Define a group
Define a container in the group
Define another container outside of the group
Add relationship either from or to the container in the group

workspace "Name" "Description"

    !identifiers hierarchical

    model {
        ss = softwareSystem "Software System" {
            a_group = group "A Group" {
                service = container "A WebApp"
                database = container "A Database"
            }
            b_container = container "B WebApp"
        }

        # below relationship is not allowed
        ss.a_group.service -> b_container "Calls"
    }

    views {
        systemContext ss "Diagram1" {
            include *
            autolayout lr
        }
    }
}

Version/build information

3.2.1

Severity

Minor

Priority

Low (I have no budget and there's no rush, please fix this for free)

More information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions