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

Sequence diagrams are unstyled with the newest PlantUML version #44

Closed
FredrikMeyer opened this issue Mar 30, 2022 · 4 comments
Closed

Comments

@FredrikMeyer
Copy link

See for example this picture from the README of this repository

image

@hakanson
Copy link
Contributor

This was an interesting PlantUML bug/regression to figure out. Take a look when I render these lines - the third participant is similar to the generated output:

actor User as user
participant OnlyLabel as t1 << APIGateway >>
participant NoLabel as t2 << ($APIGateway, #CC2264) >>
participant Both as t3 << ($APIGateway, #CC2264) APIGateway >>
participant BothZWSP as t4 << ($APIGateway, #CC2264) %chr(8203)APIGateway >>

user -> t4: winner

Sequence Diagram - Spots and stereotypes

It appears that when the text label value of the stereotype matches the name of a sprite (even without the leading $ character), it causes neither the sprite nor the <<label>> to render. The last participant does render because I pre-pended a Zero-width space which makes a different string but looks the same.

To patch this for your current projects, you can redefine AWSParticipant (from AWSCommon.puml) after your !includes but before your diagram.

!definelong AWSParticipant(p_alias, p_label, p_techn, p_color, p_sprite, p_stereo)
participant "p_label\n<size:TECHN_FONT_SIZE>[p_techn]</size>" as p_alias << ($p_sprite, p_color) %chr(8203)p_stereo >>
!enddefinelong

!definelong AWSParticipant(p_alias, p_label, p_techn, p_descr, p_color, p_sprite, p_stereo)
participant "p_label\n<size:TECHN_FONT_SIZE>[p_techn]</size>\n\n p_descr" as p_alias << ($p_sprite, p_color) %chr(8203)p_stereo>>
!enddefinelong

@hakanson
Copy link
Contributor

When building out a minimal, standalone example, I uncovered the regression relates to behavior changes with skinparam participant<<stereo>> which is triggered by AWSEntityColoring(APIGateway) from APIGateway.puml. It appears the sprite and stereotype label are "styled out" of the rendering.

An updated workaround is to add !define AWSEntityColoring(stereo) after you include AWSCommon.puml

@startuml Bug - Sprites and Stereotypes
' Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
' SPDX-License-Identifier: CC-BY-ND-2.0 (For details, see https://github.com/awslabs/aws-icons-for-plantuml/blob/main/LICENSE)

'''AWSEntityColoring usually defined in AWSCommon.puml
!define AWS_BG_COLOR #FFFFFF
!define AWS_BORDER_COLOR #FF9900

!definelong AWSEntityColoring(stereo)
skinparam participant<<stereo>> {
    BackgroundColor AWS_BG_COLOR
    BorderColor AWS_BORDER_COLOR
}
!enddefinelong
'''

'The bug happens because of the AWSEntityColoring(APIGateway) from APIGateway.puml
'A workaround is to redefine to do nothing - uncomment line below to test
'!define AWSEntityColoring(stereo)

'''$APIGateway and AWSEntityColoring(APIGateway) defined in ApplicationIntegration/APIGateway.puml
sprite $APIGateway [64x64/16z] {
xTC5biCm30JGiIfRqjp_lcMkqWqjUzuBvvlDjTFJ4uqlQJ5QA-1yYWCQOtNkan9IBTOotqoI4X9DvfvCIaZqi4zAIFImVrT2E-lt_bn2oxnpdAV_V2zIgG_7
D5-ASlDm_CZ-_tplDji7IIgSCSjRSP95wCLcUCF16ngzm2Rx4-S6mMC1Ktqv3G4s9r2c-We9ii98Xg1EzJmMKCgPSx9dXJagIKFb34-ddjuvPta6PDdwTP_d
-_ut3yRzOTCye9I7OvhNQcptXtxa-_n1ROmtHURP1ESYXlmPGnhJH1MWg0rvqm98ZOG-5Y6PbmHdyIf8_04xnyMpyNMkdPwU7G
}

AWSEntityColoring(APIGateway)
'''

actor User as user
participant OnlyLabel as p1 << APIGateway >>
participant NoLabel as p2 << ($APIGateway, #CC2264) >>
participant Both as p3 << ($APIGateway, #CC2264) APIGateway >>
participant BothZWSP as p4 << ($APIGateway, #CC2264) %chr(8203)APIGateway >>

user -> p4: renders as expected
@enduml

@hakanson
Copy link
Contributor

hakanson commented Jun 6, 2022

@FredrikMeyer - the icon release today "fixes" the issue by commenting out the skinparam participant<<stereo>>
in AWSCommon.puml causing this issue. This means diagrams render, but not with the same styling as before. Additionally, according to the linked PlantUML issue, this is fixed in their latest snapshot. After that release, we can look at reverting this change.

!definelong AWSEntityColoring(stereo)
skinparam rectangle<<stereo>> {
    BackgroundColor AWS_BG_COLOR
    BorderColor AWS_BORDER_COLOR
}
' https://github.com/plantuml/plantuml/issues/1023
'skinparam participant<<stereo>> {
'    BackgroundColor AWS_BG_COLOR
'    BorderColor AWS_BORDER_COLOR
'}
!enddefinelong

Would you like to keep this issue open until then, or should we close?

@FredrikMeyer
Copy link
Author

Sorry for the late reply!

We just updated the plantuml version, and now diagrams seem to render correctly. Thanks for the effort!

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

No branches or pull requests

2 participants