mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown

Home Page:https://mermaid.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for nested namespaces

skillmaker-dev opened this issue · comments

Proposal

I think it would be a great feature to have, nested namespaces make it easier to represent packages or namespaces in which classes reside, and it should be possible either by creating a namespace inside another namespace or by separating namespaces with a dot like this namespace example1.example2.example3 {}

Example

for example in PlantUML, nested packages or namespaces can be represented like this package foo1.foo2.foo3 { class Object }

Screenshots

The previous example will be represented in this way in plantUML:
image

Hi, I just encountered the same problem. I also think that this item should be documented.

However, I have found a solution, although this behavior is unpredictable and not obvious to me.

So, I created 2 namespaces at the same level, and then I put the "children" as a class in the "main" one.
It looks something like this:

classDiagram

namespace presentation{
    class auth
    class main
}
namespace auth{
    class AuthScreen
    class AuthViewModel
}
namespace main{
    class MainScreen
    class MainViewModel
}
classDiagram

namespace presentation{
    class auth
    class main
}
namespace auth{
    class AuthScreen
    class AuthViewModel
}
namespace main{
    class MainScreen
    class MainViewModel
}

Hi, I just encountered the same problem. I also think that this item should be documented.

However, I have found a solution, although this behavior is unpredictable and not obvious to me.

So, I created 2 namespaces at the same level, and then I put the "children" as a class in the "main" one. It looks something like this:

classDiagram

namespace presentation{
    class auth
    class main
}
namespace auth{
    class AuthScreen
    class AuthViewModel
}
namespace main{
    class MainScreen
    class MainViewModel
}
classDiagram

namespace presentation{
    class auth
    class main
}
namespace auth{
    class AuthScreen
    class AuthViewModel
}
namespace main{
    class MainScreen
    class MainViewModel
}

That's a nice workaround, the namespace is behaving like a class and therefore it is being surrounded by the box and then you change it to be a namespace, I hope they create this feature, No one replied to this issue so far apart from you :(