-
Notifications
You must be signed in to change notification settings - Fork 299
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
Support for database component type in plantuml #1132
Comments
Issue: TNG#1132 Signed-off-by: Tomasz Fijalkowski <3066563+tfij@users.noreply.github.com>
Issue: TNG#1132 Signed-off-by: Tomasz Fijalkowski <3066563+tfij@users.noreply.github.com>
Hi! I came upon the same problem. I can't use PlantUML Component Diagrams as rules with a PlantUML diagram that features ArchUnit can remain agnostic to database connections and should not raise errors when it encounters them during analysis - instead, it could ignore these components to maintain its focus on architectural concerns (or maybe this option should be configurable). Database connections are typically not considered architectural concerns at a high level. Yet including them in a resulting diagram for the sake of documentation - would be a cool feature. @hankem WDYT? :) I believe @tfij has already done some work to make it work in #1133 |
Big apologies for the slow follow up! I was unfortunately deeply overloaded over the last months 🙈 @tfij Thanks for the initiative, but to be honest I'd like to discuss this a little before. Because I don't see a use case per se for ArchUnit to understand databases as there can be no checks done on this. I understand that you simply want to extend your diagram with extra context information that you want ignored by ArchUnit, right? |
This change is not about understanding database components but does not crash on parsing valid plantUML diagrams. I agree that we still don't support full plantUML, but step by step we can achieve it. A solution with extra comments is a workaround, ArchUnit will still be unable to parse valid diagrams. In my opinion, the most convenient solution should allow you to take an existing diagram and run it as a test. Then you can have one diagram for documentation and testing. In other words, tests confirm that the documentation is up to date. The commented solution will allow you to use the same diagram, but it is not user-friendly. The user not only has to add additional code to the diagram. The user must know that such a code needs to be added. So the documentation needs to be expanded and the user needs to find this piece of documentation. Still, valid diagrams will not be parsed correctly and changes will need to be made to them to be handled by ArchUnit. That is why I say this is a workaround. |
Just that from my point of view the idea never was that ArchUnit can understand all PlantUML diagrams. It was always meant to just take a well-defined subset (that keeps complexity low) and use that as a test input for convenience. To have something visual as a test input. Or, as another option I could imagine we could just ignore "invalid" dependencies altogether instead of throwing an exception (which would similar to other behavior, because I think it already ignores unparsable lines atm, if they don't match any known pattern). Because in the end this doesn't increase danger of writing "false green" tests, since it would just consider less dependencies as allowed than the user intended. Downside of this is of course that it could create a hassle for users to locate why their test behaves weirdly if they specified an intended dependency in an invalid way 🤷♂️ |
The second approach which you've suggested should be OK. Just to ignore mismatched dependencies instead of throwing an exception. However, I'd like to add I can prepare a PR if you are ok with it. |
PR #1184 |
@codecholeric Have you had a chance to check out this PR? |
@tfij sorry that I was a little slow on this! I looked into the PR, thanks a lot! I think it's a good compromise after our discussions 🙂 Please let me know what you think about my review comments in the PR! |
Issue: TNG#1132 Signed-off-by: Tomasz Fijalkowski <3066563+tfij@users.noreply.github.com>
The current implementation prevents using PlantUML diagrams as rules that are used for wider documentation purposes (e.g. containing a database component or some other dependency that's irrelevant from the point of an ArchUnit test). The consequence of ignoring such unknown components is only to allow fewer dependencies and fewer classes to be present. So, at best the test will fail as a false positive, if the components are declared wrongly by accident. Thus, there is no major harm in simply ignoring these unknown components and giving users a little more freedom what elements they want to use in their diagrams. Issue: TNG#1132 Signed-off-by: Tomasz Fijalkowski <3066563+tfij@users.noreply.github.com>
The current implementation prevents using PlantUML diagrams as rules that are used for wider documentation purposes (e.g. containing a database component or some other dependency that's irrelevant from the point of an ArchUnit test). The consequence of ignoring such unknown components is only to allow fewer dependencies and fewer classes to be present. So, at best the test will fail as a false positive, if the components are declared wrongly by accident. Thus, there is no major harm in simply ignoring these unknown components and giving users a little more freedom what elements they want to use in their diagrams. Issue: TNG#1132 Signed-off-by: Tomasz Fijalkowski <3066563+tfij@users.noreply.github.com>
The current implementation prevents using PlantUML diagrams as rules that are used for wider documentation purposes (e.g. containing a database component or some other dependency that's irrelevant from the point of an ArchUnit test). The consequence of ignoring such unknown components is only to allow fewer dependencies and fewer classes to be present. So, at best the test will fail as a false positive, if the components are declared wrongly by accident. Thus, there is no major harm in simply ignoring these unknown components and giving users a little more freedom what elements they want to use in their diagrams. Issue: TNG#1132 Signed-off-by: Tomasz Fijalkowski <3066563+tfij@users.noreply.github.com>
The current implementation prevents using PlantUML diagrams as rules that are used for wider documentation purposes (e.g. containing a database component or some other dependency that's irrelevant from the point of an ArchUnit test). The consequence of ignoring such unknown components is only to allow fewer dependencies and fewer classes to be present. So, at best the test will fail as a false positive, if the components are declared wrongly by accident. Thus, there is no major harm in simply ignoring these unknown components and giving users a little more freedom what elements they want to use in their diagrams. Resolves: #1132
Is there a specific reason that you are using only components in these diagrams? Would it be ok if I provide a PR that also allows to use packages? Actually we are enforcing package rules and not component rules. So I would prefer to use a package UML diagram (and not a component diagram). |
Your proposal sounds good. |
It will be great if Archunit could support such diagrams:
www.plantuml.com/plantuml/png/SoWkIImgAStDuU9AIIn9J4eiJbLGSd5IuahEpot8pqlDAr68TWOo3MCLR6pqz98DzVJixD0b5OnY5HAB5K1C8uWo8x0oBgY8hYxC4AY8hfs2YnCNbqDgNWhGQW00
In this case, the database component and the dependency on the database component could be just ignored.
The text was updated successfully, but these errors were encountered: