mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Add `package` to class diagram

Open queses opened this issue 5 years ago • 33 comments

Is your feature request related to a problem? Please describe.

Hello! Иon-native English speaker warning

I'm relative frequently drawing class diagrams. For now I'm using MagicDraw but I would like to try text-to-scheme solution.

I like your syntax for class diagrams and I would be very happy to use it for my work but I frequently using packages in my schemes. Like class A goes to package X and associated with class B that laying in package Y.

Describe the solution you'd like

I would like to have a package extension for current syntax like:

package Sales {
  class Product {
    +int id
  }
  Product o-- Employees.Manager

package Employees {
  class Manager {
    +int id
  }
}

Describe alternatives you've considered Do not see any

Additional context None

queses avatar Nov 06 '19 12:11 queses

Perhaps namespace instead or package?

IOrlandoni avatar Nov 06 '19 12:11 IOrlandoni

Well, I just sticked to MagicDraw and Java terms. Its absolutely okay if this thing will be called "namespace"

queses avatar Nov 06 '19 12:11 queses

How does this look in MagicDraw? Could you provide a screenshot of the resulting diagram?

klemmchr avatar Nov 06 '19 13:11 klemmchr

There is two packages - "Специалист" ("Specialist") и "Ядро" (Kernel). They are modules in my app.

image

queses avatar Nov 07 '19 08:11 queses

Cool, that might be a slightly bigger task, if someone is up to grab it. Should packages be nestable?

klemmchr avatar Nov 07 '19 09:11 klemmchr

As for my task it's not required, because I use them as modules. Modules in my applications structure shouldn't be nested. However I believe that somebody would be happy with nested packages.

So, answering your question - I think that it depends on how hard it will be to implement nested modules. If it creates significant technical complexity then don't do it :)

queses avatar Nov 07 '19 09:11 queses

Desperately need this feature 😂

dchjmichael avatar Nov 16 '19 00:11 dchjmichael

I would like to take this on, if no one is opposed...

jgreywolf avatar Dec 06 '19 20:12 jgreywolf

I would like to take this on, if no one is opposed...

Great. Love to see how active you are!

klemmchr avatar Dec 06 '19 20:12 klemmchr

Would it be possible to re-open this issue? I think this is highly important and required feature when modeling real life/large information models. Could a quick fix be to enable Subgraphs from Flowchart for Class Diagrams as well?

ismarslomic avatar Apr 09 '20 09:04 ismarslomic

This issue is still open.

klemmchr avatar Apr 09 '20 10:04 klemmchr

Due to some issues that I ran into when trying to implement this, I decided to wait until the new rendering engine is ready to continue. However, Im not sure when that will be, so maybe I should start working on this again :)

Ive been on "hiatus" from the project the past month or so to deal with other issues. You know, just some random things going on with family, the world, whatever ;)

Im getting ready to start up again, and this is one of the main issues I intend to come back to

jgreywolf avatar Apr 09 '20 14:04 jgreywolf

👍 would love to see this in mermaid... lack of this feature had me going back to plantuml...

jannismain avatar Jul 23 '20 13:07 jannismain

Should packages be nestable? I would like to have nestable packages / namespaces. My use case is related to representing packages or submodules inside microservices. I also want to represent microservices as packages / namespaces and annotate them with stereotypes. I will try to add examples in the future.

dellagustin-sap avatar Sep 16 '20 08:09 dellagustin-sap

Any update on this?

ricardorauber-poatek avatar Oct 29 '20 20:10 ricardorauber-poatek

Sorry, no - I had put the work on hold until the new version of rendering engine was completed. Now that this is in place I will get back to this item

jgreywolf avatar Oct 30 '20 19:10 jgreywolf

Cool, thanks for the reply!

ricardorauber-poatek avatar Oct 30 '20 19:10 ricardorauber-poatek

Hi @jgreywolf, have you made any progress on this?

bowdi avatar Apr 29 '21 08:04 bowdi

First things first: Thanks for Mermaid! Just want to chime in that this would be a great option to have!

HorstBaerbel avatar Aug 20 '21 09:08 HorstBaerbel

Would also like to bump this, would love to see this feature.

megretson avatar Sep 08 '21 13:09 megretson

Mermaid is amazing. This feature would make me say the same thing but in ALL CAPS. Cheers

dorev avatar Oct 21 '21 16:10 dorev

I need this, please help!

FatsharkGo avatar Dec 03 '21 08:12 FatsharkGo

Hi,

I'd like a feature which seems to be related to this, but is likely simpler: Just group some related classes together, so they keep together when layouting. I don't have a need of actually drawing a package box around them, but I don't want those classes be spread around randomly in my diagram.

Of course, this could also be implemented with the package box, and then just hiding it.

ePaul avatar Feb 03 '22 10:02 ePaul

to implement this function, need to extend specification of class-diagrams syntax. who does define specification?

ksilverwall avatar Mar 07 '22 01:03 ksilverwall

Does anyone know latest updates about this feature?

czs108 avatar May 21 '22 13:05 czs108

Hey,

I would like to express how much I enjoy using mermaid over other tools for diagramming. Its great to be able to version code and documentation next to each other in the same folder.

My current project really needs this feature, so I have set up a bounty for it here: https://app.bountysource.com/issues/83273957-add-package-to-class-diagram

If you decide to work on it, please call it "namespace" instead of "package". Also I would appriciate it very much to be nestable like so:

namespace Factory {
    namespace Employees {
        class Technician {
            +int id
        }
    }
}

I hope this convinces someone to built the feature, keep on rocking Mermaid! :)

sebastianbergt avatar Aug 08 '22 11:08 sebastianbergt

+1

aivanov-oneinc avatar Aug 16 '22 19:08 aivanov-oneinc

Hi! I discovered recently this amazing tool to draw diagrams, which I liked very much, and I'm eager to see when the package/namespace feature will be implemented!

parnumeric avatar Dec 05 '22 15:12 parnumeric

+1

stevenlafl avatar Jan 10 '23 15:01 stevenlafl

+1

wacaine avatar Mar 08 '23 16:03 wacaine