Repository navigation
Stop deriving Namespace from Slice - #512
Open
alexanderlinne wants to merge 1 commit into
Open
alexanderlinne wants to merge 1 commit into
alexanderlinne wants to merge 1 commit into
Conversation
Namespace has derived from Slice since the initial import, but uses almost nothing from it: the loader creates it with an empty list and fills Types by casting it back, and ArchBuilder only reads Types. The inheritance also gave it Identifier, NameSpace, CountOfAsteriskInPattern and ContainsNamespace(), which mean nothing for a namespace, and tied its Name and FullName to how slices describe themselves. Namespace is now a class of its own that implements IHasName, IHasDescription and IHasDependencies. Name, FullName, Description, Types, Classes, Interfaces, Dependencies, BackwardsDependencies and equality by full name are unchanged. The loader adds types through an internal AddType instead of the cast. The namespace parts of PlantUmlFileBuilder.WithDependenciesFrom(slices) move into a new overload WithDependenciesFrom(IEnumerable<Namespace>), so WithDependenciesFrom(Architecture.Namespaces) keeps compiling and drawing the same diagram. The slice overload and focus mode lose their "slice is Namespace" branches; the comment there already said that namespaces and slices can't be mixed in one diagram. Both overloads choose dependency targets and drop nodes without dependencies through the same generic helpers. The node removal now collects the nodes before removing them, as removing entries while enumerating a dictionary throws on .NET Framework. A snapshot of a namespace diagram, recorded before the change, pins the output, and a test pins namespace equality. Breaking changes: - Namespace no longer derives from Slice. Code that used a Namespace as a Slice, or used Identifier, NameSpace, CountOfAsteriskInPattern or ContainsNamespace() on it, no longer compiles. - Namespaces can no longer be passed to the slice overload of WithDependenciesFrom or to WithDependenciesFromFocusOn. Signed-off-by: Alexander Linne <alexander.linne@tngtech.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #512 +/- ##
==========================================
- Coverage 86.51% 86.49% -0.02%
==========================================
Files 261 261
Lines 12610 12675 +65
Branches 1233 1238 +5
==========================================
+ Hits 10909 10963 +54
- Misses 1359 1366 +7
- Partials 342 346 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alexanderlinne
added this pull request to stack #514
October 24, 2026 15:57
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Namespace has derived from Slice since the initial import, but uses almost nothing from it: the loader creates it with an empty list and fills Types by casting it back, and ArchBuilder only reads Types. The inheritance also gave it Identifier, NameSpace, CountOfAsteriskInPattern and ContainsNamespace(), which mean nothing for a namespace, and tied its Name and FullName to how slices describe themselves.
Namespace is now a class of its own that implements IHasName, IHasDescription and IHasDependencies. Name, FullName, Description, Types, Classes, Interfaces, Dependencies, BackwardsDependencies and equality by full name are unchanged. The loader adds types through an internal AddType instead of the cast.
The namespace parts of PlantUmlFileBuilder.WithDependenciesFrom(slices) move into a new overload WithDependenciesFrom(IEnumerable), so WithDependenciesFrom(Architecture.Namespaces) keeps compiling and drawing the same diagram. The slice overload and focus mode lose their "slice is Namespace" branches; the comment there already said that namespaces and slices can't be mixed in one diagram.
Both overloads choose dependency targets and drop nodes without dependencies through the same generic helpers. The node removal now collects the nodes before removing them, as removing entries while enumerating a dictionary throws on .NET Framework.
A snapshot of a namespace diagram, recorded before the change, pins the output, and a test pins namespace equality.
Breaking changes: