Closed npouliquen closed 2 months ago
My initial though would be a comma-separated list of imports in a workspace property named ilograph.imports
, in the form of something like: AWS:ilograph/aws
I've added support for icons, which will use a property named ilograph.icon
on the element style if it exists, and the icon
property on the element style otherwise.
What would this be used for?
IlographExporter
class, but I imagine it exists in a superclass.instanceOf
in Ilograph serves as a way to reduce repetition in a diagram. It's a mechanism for inheritance. The example given in the Ilograph documentation is when diagramming a computer network, you could have 2 identical network switches deployed. These would have the same properties. Using instanceOf
allows you to not repeat yourself redefining these properties. Here is a link to that explanation. For 3, I was diagramming a couple services my team owns, one upstream service, and one downstream. All the services are doing some async event handling. Each service has an SNS topic, SQS queue, and Lambda to process messages. I repeated this 4 times, which is fine, but having an abstract definition of an Ilograph resource which I can then say everything else is an instanceOf
is a few less lines of writing overall.
Unrelated, but I appreciate you acting so quickly to implement these changes. A talk you gave on C4 came up in my YouTube recommended. I found the idea of models as code very compelling. I was playing around with it last week as a proof of concept. I am sold. Now I am going to pitch to my team a requirement to add C4 models with every commit that adds new functionality.
You're welcome! Do you have a code example of how you want to use instanceOf
? From the docs I can see how it's intended to be used, but I don't understand how this would work given the Ilograph code is being generated by the exporter. If you take the example from the docs:
How would you create a relationship to/from an instance of the switch?
I typed out an explanation and only upon expanding on this idea did I realize it isn't useful, as the relationships would not be able to be defined in Structurizr DSL. The only way would be to also add support for the abstract
property in Structurizr, but then you would also have to build in some inheritance structure in the library as well. I think that becomes quite complicated.
So, the only use of adding this would be to support importing resources from Ilograph's standard library. Currently, the only thing that's there is a theme for AWS resources. They claim this will expand soon, but given nothing has been added there in 3 years, I am doubtful. Given that there is already support for colors and now icons, the same theming can be done from Structurizr. I'm much less concerned about this specific feature now. I was initially intending to use it to do some abstraction in a separate file, which I would then import, but this won't work based on what I explained in the first paragraph.
I typed out an explanation and only upon expanding on this idea did I realize it isn't useful, as the relationships would not be able to be defined in Structurizr DSL.
I came to the same conclusion, but I don't use Ilograph, so wasn't sure if I'd missed something. Thanks for the info!
Description
Currently, the Ilograph exporter lacks support for some Ilograph features. Most notably to me:
I believe these could be supported through the
properties
field inWorkspace
andElement
. It seems like there is precedent for using properties to support features specific to an export type based on this line in the PlantUML exporter.To support
icon
andinstanceOf
, there could simply be a check for those strings in theproperties
map in thewriteElement
method. Supporting imports is harder, as each Ilograph import has 2 properties,from
andnamespace
. The way it needs to be formatted in the output is like this:My best thought right now would be to just have a check for a property with key
"imports"
and a value of"- from: ilograph/aws\nnamespace: AWS"
. This looks kinda ugly, but I cannot think of a better way given the class structure of the structurizr library. Happy to hear if anyone has any better ideas. I'm more than willing to implement this feature myself, as it is something I would really value.Priority
I'm willing to add this feature myself and raise a PR (please confirm approach first)
More information
No response