Skip to content

Unable to call parse() methods in plugins due to DSL parser validation additional curl brace validation #304

@mattjamison

Description

@mattjamison

Description

I noticed when testing with the latest structurizr-lite client, that a java plugin I've been using to parse a small DSL fragment via the exposed parse() method now throws an exception. I tracked back to commit 545cd230b176dd9e85decd9909c20e21365d4687, which pulls in the structurizr-java version including the curly brace validation in issue 252.

The plugin is really simple, it walks the project files, parsing and including small DSL fragments containing style definitions. I'm doing this to essentially allow the addition of any number of *.style files to our project, that the plugin will read and include in the final workspace. I'm definitely open to any other methods to accomplish this. What I would have love to have done instead is used a glob with the !include directive for example, but I don't believe that's possible and thus the plugin.

I'm happy to submit a PR with what I think is a simpler fix, which would be to expose a parse() method with the boolean include parameter, which essentially disables the problematic validation for internal uses of parse().

Steps to reproduce

  1. Utilize a structurizr-lite version >= v2024.03.02 (545cd230b176dd9e85decd9909c20e21365d4687)
  2. Call the parse() method from a plugin:
    context.getDslParser().parse(path.toFile());
  3. Exception thrown:
    com.structurizr.dsl.StructurizrDslParserException: Unexpected end of DSL content - are one or more closing curly braces missing?

Screenshot

No response

Code sample

`context.getDslParser().parse(path.toFile());`

Configuration

No response

Severity

Minor

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