structurizr / dsl

Structurizr DSL
https://docs.structurizr.com/dsl
Apache License 2.0
1.41k stars 265 forks source link

Propagate the `IdentifiersRegister` to the `StructurizrDslPluginContext` #361

Closed bioform closed 11 months ago

bioform commented 12 months ago

Description

At the current moment, the IdentifiersRegister is not available in the StructurizrDslPluginContext (see: https://github.com/structurizr/dsl/blob/682129a1dafc5f8a395b5dc8a5391140760046b8/src/main/java/com/structurizr/dsl/PluginDslContext.java#L27) But it is available in the above line context (see https://github.com/structurizr/dsl/blob/682129a1dafc5f8a395b5dc8a5391140760046b8/src/main/java/com/structurizr/dsl/DslContext.java#L21C35-L21C54)

Without IdentifiersRegister in the plugin context, it is impossible to register identifiers for the elements created inside the context.

I would really appreciate it if you would add the IdentifiersRegister to the StructurizrDslPluginContext

Priority

Medium

Resolution

I'm willing to add this feature myself and raise a PR

More information

No response

bioform commented 11 months ago

I've prepared the PR for it https://github.com/structurizr/dsl/pull/367

simonbrowndotje commented 11 months ago

Thanks for the PR ... my plan is to resolve this issue another way though, by providing access to the DSL parser, which means you can then do:

context.getDslParser().getIdentifiersRegister()

(this additionally provides users with the ability to parse arbitrary DSL fragments from plugins, etc)