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

Dashes not supported in sequence diagram participant definitions #3078

Closed
willbicks opened this issue May 27, 2022 · 2 comments · Fixed by #3524
Closed

Dashes not supported in sequence diagram participant definitions #3078

willbicks opened this issue May 27, 2022 · 2 comments · Fixed by #3524
Labels
Type: Bug / Error Something isn't working or is incorrect

Comments

@willbicks
Copy link

Describe the bug

According to #1228 and #1574, dashes / hyphens (-) should be supported in sequence diagrams. And indeed, if actors are only implicitly defined, they can be used when specifying relationships.

However, if actors are explicitly defined using participant tags (as described in the docs), the diagram fails to render. If escape characters are used, duplicate actors are created.

As software components often contain dashes in their names, it would be helpful to be able to represent those as accurately as possible.

To Reproduce

Attempt to render any of the following diagrams:

sequenceDiagram
    participant jelly-bean
    participant chocolate-chip

    jelly-bean->chocolate-chip: applies heat
    chocolate-chip->jelly-bean: reports melting condition
sequenceDiagram
    participant jelly#45;bean
    participant chocolate#45;chip

    jelly-bean->chocolate-chip: applies heat
    chocolate-chip->jelly-bean: reports melting condition
sequenceDiagram
    participant jelly#45;bean
    participant chocolate#45;chip

    jelly#45bean->chocolate#45chip: applies heat
    chocolate#45chip->jelly#45bean: reports melting condition

Expected behavior

That the above samples render as below:

sequenceDiagram
    jelly-bean->>chocolate-chip: applies heat
    chocolate-chip->>jelly-bean: reports melting condition
Loading

The expected behavior would be that there would be a way to include dashes in actor names, both when declaring participants, and describing messages.

The most convenient way to allow this would be to support directly typing dashes in both participant and message descriptions, or allow quotation marks to describe literal names in both, escaping the interpretation of any special characters.

Additional context

#1228
#1574

@willbicks willbicks added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels May 27, 2022
@financelurker
Copy link

financelurker commented May 28, 2022

You can try to use an alias for the participants, using "as":

sequenceDiagram
    participant JB as jelly-bean
    participant CC as chocolate-chip

    JB->CC: applies heat
    CC->JB: reports melting condition

That would render the expected diagram as a workaround.
But yeah, interesting, since there are unit tests checking this very behavior...

@knsv knsv added bug and removed Status: Triage Needs to be verified, categorized, etc labels Aug 21, 2022
@ashleybartlett
Copy link

I ran into this one yesterday, and I think I found a fix for it and have put up a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants