structurizr / cli

A command line utility for Structurizr.
https://docs.structurizr.com/cli
Apache License 2.0
500 stars 77 forks source link

`title` property not supported in DSL #12

Closed janslow closed 3 years ago

janslow commented 3 years ago

First off, thanks for the effort you've put into this project, I've found it really useful!

However, I've been trying to use the view title property in the DSL, but I'm getting an "unexpected tokens error" (using v1.4.5).

Example

Input

workspace "Getting Started" "This is a model of my software system." {
    model {
        user = person "User" "A user of my software system."
        softwareSystem = softwareSystem "Software System" "My software system."

        user -> softwareSystem "Uses"
    }

    views {
        systemContext softwareSystem "SystemContext" "An example of a System Context diagram." {
            title "Foo"
            include *
            autoLayout
        }
    }
}

Reproduction Steps

structurizr-cli export -workspace /input.dsl -output /output --format json

Expected behaviour

CLI should finish successfully and write the workspace to /output/structurizr.json.

The input works fine at https://structurizr.com/dsl.

Actual Behaviour

Structurizr CLI v1.4.5
Exporting workspace from /input.dsl
 - loading workspace from DSL
2020-11-11 23:08:48.382 ERROR 11 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) [spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:779) [spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) [spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE]
        at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:69) [classes!/:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [structurizr-cli-1.4.5.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:109) [structurizr-cli-1.4.5.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [structurizr-cli-1.4.5.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [structurizr-cli-1.4.5.jar:na]
Caused by: com.structurizr.dsl.StructurizrDslParserException: Unexpected tokens at line 12: title "Foo"
        at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:482) ~[structurizr-dsl-1.0.0.jar!/:na]
        at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:140) ~[structurizr-dsl-1.0.0.jar!/:na]
        at com.structurizr.cli.ExportCommand.run(ExportCommand.java:104) ~[classes!/:na]
        at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:40) [classes!/:na]
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:795) [spring-boot-2.3.0.RELEASE.jar!/:2.3.0.RELEASE]
        ... 13 common frames omitted

I'm guessing the Structurizr DSL JAR just needs updating (I'd be happy to do this, if you're willing to review the PR, although it won't have a very reviewable diff 😄)

simonbrowndotje commented 3 years ago

Thanks, yes, a new CLI release is due today/tomorrow that will include the recent DSL updates (including the title property).

janslow commented 3 years ago

Great, thanks for the quick response.

simonbrowndotje commented 3 years ago

This is now supported in v1.5.0.