Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nested namespaces #5487

Closed
skillmaker-dev opened this issue Apr 24, 2024 · 8 comments · Fixed by #5849
Closed

Add support for nested namespaces #5487

skillmaker-dev opened this issue Apr 24, 2024 · 8 comments · Fixed by #5849

Comments

@skillmaker-dev
Copy link

skillmaker-dev commented Apr 24, 2024

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

@skillmaker-dev skillmaker-dev added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Apr 24, 2024
@Khar-Ma2
Copy link

Khar-Ma2 commented May 10, 2024

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
}
Loading

@skillmaker-dev
Copy link
Author

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
}
Loading

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 :(

@nirname
Copy link
Contributor

nirname commented Jun 19, 2024

Hello! Thanks for the suggestion. Is this workaround enough so we can close the issue, or you are still interested in something like

classDiagram

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

@nirname nirname added Status: Pending Is not to be executed as it currently is Graph: Flow and removed Status: Triage Needs to be verified, categorized, etc labels Jun 19, 2024
@skillmaker-dev
Copy link
Author

I think

classDiagram

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

or this are better than the workaround because it is somehow confusing when working with a large codebase.

namespace example1.example2.example3 
{
	class class1
}

@nirname
Copy link
Contributor

nirname commented Jun 20, 2024

@skillmaker-dev would you like to make a contribution?

@nirname nirname added Contributor needed Status: Approved Is ready to be worked on Area: Development and removed Status: Pending Is not to be executed as it currently is labels Jun 20, 2024
@skillmaker-dev
Copy link
Author

@nirname I will try my best after taking a look at the codebase.

@ReneLombard
Copy link
Contributor

@nirname and @skillmaker-dev I've made an attempt to resolve this issue. Please see the following pull request:
#5849

@ReneLombard
Copy link
Contributor

@nirname can I assign the pull request to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants