plantuml-stdlib / C4-PlantUML

C4-PlantUML combines the benefits of PlantUML and the C4 model for providing a simple way of describing and communicate software architectures
MIT License
6.33k stars 1.1k forks source link

Allow use of collections in c4 diagrams #309

Closed jlesueur closed 1 year ago

jlesueur commented 1 year ago

Currently, there is no way to create a collection in either context or container level. Here is an example showing how a RBAC permission system can work:

image

kirchsth commented 1 year ago

Hi @jlesueur,

thank you for your suggestion, but I'm really not sure if we should add a new shape to the standard, because it would requires also 6 additional Element calls (SystemCollection, SystemCollection_Ext, ContainerCollection, ContainerCollection_Ext, ComponentCollection, ComponentCollection_Ext), a detailed discussion can found Support more Shapes. @Potherca what do you think?

Personally I would suggest $shadowing=true or a specific color as collection marker, but of course you could use a specific $sprite=... for that too.

If you still want your additional shape you could define it based on following pattern. It should (basically) work, maybe there are some minor changes required in the meantime.

Best regards Helmut

PS.: In your solution the definition of the ComponentCollection(), ... procedures is missing. Did you added all files to the commit?

kirchsth commented 1 year ago

I fixed the sample and fill the missing $shape with "".

jlesueur commented 1 year ago

Hi @kirchsth,

Yeah, I didn't include the ContainerCollection code, as I was just aiming at adding support so that it could be added as a custom thing, not part of the framework. Of course, I'm not opinionated about that. Those suggestions (shadowing and a sprite), seem pretty good too. Thanks for pointing me to the other discussion.

kirchsth commented 1 year ago

Similar like #145, additional shapes can be added with a custom include file (details see above)