user29715992
user29715992

Reputation:

How to use '!include' without Structurizr

How can I use !include within Structurizr, allowing more than one file to be added within the same workspace, my attempt:

File 1

workspace {

    # Inclui o outro arquivo antes do model
    !include /home/teste/Structurizr/testesinclude/teste2.dsl  
    !include /home/teste/Structurizr/testesinclude/teste3.dsl  



    views {
        systemContext InsuranceSystems {
            include *
            autolayout
        }
        
        component vidaConApolices {
            include *
            autolayout
        }
    }
}

In others files, the same pattern this:

model {
    softwareSystem = softwareSystem "Insurance Systems" {
        cont1= container "Cont1"  {
            element1= component "Element1"
        }
    }
}

But it's giving an error, I don't know how to structure the files correctly, and how I should mention the .dsl files within the same workspace, since doing the same gives an error in both files

I've already tried using 'extends', but I can only extend one file, and no more, as I need to do.

Using extends, it works, but it doesn't meet my needs.

I using the Structurizr

Upvotes: 0

Views: 18

Answers (1)

Alex Ramirez
Alex Ramirez

Reputation: 133

The example in https://eidivandiomid.medium.com/diagram-as-code-using-structurizr-c41f6dd0738f worked for me. I'm rendering using the docker Structurizr lite.

I must say, if you are using the C4 DSL extension in VS Code, it will mark errors in all the other dsl files, complaining of a missing "workspace" token. something similar to:

Unexpected tokens (expected: workspace) at line 1 of your path\otherfile.dsl: Product = softwareSystem "Product System" {

but the files are correctly rendered by the server. If that is your case, I would recommend to change the extension to other, like https://marketplace.visualstudio.com/items?itemName=ciarant.vscode-structurizr .

Upvotes: 0

Related Questions