Skip to content

Importing docs fails on files without extension #251

@KlfJoat

Description

@KlfJoat

Description

(I'm sorry, but your bug format isn't fitting into my brain right now, so I'm going to provide most of the info in my own format)

Observed Behavior

When running the latest structurizr-lite.war on my workspace, I get an error in the web interface:

workspace.dsl: Error importing documentation from /home/klfjoat/src/project-name/docs/.: java.lang.StringIndexOutOfBoundsException: begin -1, end 6, length 6 at line 3 of /home/klfjoat/src/project-name/docs/workspace.dsl: !docs .

I see this error in the command line output

2024-02-17T13:28:43.662-06:00 ERROR 590777 --- [nio-8080-exec-1] s.l.c.w.FileSystemWorkspaceComponentImpl : com.structurizr.dsl.StructurizrDslParserException: Error importing documentation from /home/klfjoat/src/project-name/docs/.: java.lang.StringIndexOutOfBoundsException: begin -1, end 6, length 6 at line 3 of /home/klfjoat/src/project-name/docs/workspace.dsl: !docs .

I have not changed my workspace.dsl file in about 5 months and it used to work.

I have plenty of .md files in the same directory as workspace.dsl and in the past structurizr-lite has gleefully taken those files and displayed them for me.

Expected Behavior

Recognize that . means 'the current directory' and pull .md files from the same directory as the workspace.dsl file.

Troubleshooting Steps

I have reduced the workspace.dsl file to the bare minimum, as you can see below, and it still throws the error. This error prevents anything from showing in the web interface, even the diagrams, ADRs, and documentation (ofc).

I have tried combinations of changing the path provided to structurizr-lite.war, the path of the !docs line, etc. With and without trailing slashes, with named subdirs, everything I can think of.

Steps to reproduce

  1. Create a workspace.dsl file with the contents of the canonical example file at https://docs.structurizr.com/dsl/example
  2. Add a !docs . line as shown below.
  3. Have .md files in the same directory as the workspace.dsl file.
  4. Run java -Djdk.util.jar.enableMultiRelease=false -jar structurizr-lite.war /home/klfjoat/src/project-name/docs
  5. Open URL
  6. See error message in command-line and web UI.

Screenshot

No response

Code sample

workspace {

    !docs .

    model {
        user = person "User"
        softwareSystem = softwareSystem "Software System"

        user -> softwareSystem "Uses"
    }

    views {
        systemContext softwareSystem {
            include *
            autolayout lr
        }
    }
}

Configuration

Build 2024.01.02

Severity

Critical

Priority

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions