Skip to content

Conversation

@omkarht
Copy link
Contributor

@omkarht omkarht commented Nov 6, 2025

📑 Summary

This PR adds comprehensive alias support for participants in Sequence Diagrams, enabling users to define aliases in two ways:

  1. External Alias Syntax (using as keyword): Combine participant stereotypes with aliases using syntax like participant API@{ "type" : "boundary" } as Public API
  2. Inline Alias Syntax (inside config object): Define aliases directly in the configuration object like participant API@{ "type": "boundary", "alias": "Public API" }

Both syntaxes allow users to assign UML stereotype types and descriptive aliases to participants, with full backward compatibility maintained.

🎯 Key Features

1. External Alias Syntax

Users can now use the as keyword after stereotype configuration:

sequenceDiagram-+
  participant API@{ "type" : "boundary" } as Public API
  actor DB@{ "type" : "database" } as User Database
  participant Svc@{ "type" : "control" } as Auth Service

  API ->> Svc: Authenticate
  Svc ->> DB: Query user
  DB -->> Svc: User data
  Svc -->> API: Token

2. Inline Alias Syntax

Users can define aliases directly inside the configuration object:

sequenceDiagram
  participant API@{ "type": "boundary", "alias": "Public API" }
  participant Auth@{ "type": "control", "alias": "Auth Service" }
  participant DB@{ "type": "database", "alias": "User Database" }
  
  API->>Auth: Login request
  Auth->>DB: Query user
  DB-->>Auth: User data
  Auth-->>API: Access token

3. Precedence Rule

When both inline and external aliases are provided, the external alias takes precedence:

sequenceDiagram
  participant API@{ "type": "boundary", "alias": "Internal Name" } as External Name
  [ # Will display as "External Name"]

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

🦋 Changeset detected

Latest commit: b33ce14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Nov 6, 2025

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit b33ce14
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/6916d277eccf710008802f2d
😎 Deploy Preview https://deploy-preview-7136--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 6, 2025

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/examples@7136

mermaid

npm i https://pkg.pr.new/mermaid-js/mermaid@7136

@mermaid-js/layout-elk

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@7136

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-tidy-tree@7136

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@7136

@mermaid-js/parser

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@7136

@mermaid-js/tiny

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/tiny@7136

commit: b33ce14

@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.55%. Comparing base (6b9f26d) to head (b33ce14).

Files with missing lines Patch % Lines
...ckages/mermaid/src/diagrams/sequence/sequenceDb.ts 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #7136      +/-   ##
==========================================
- Coverage     3.55%   3.55%   -0.01%     
==========================================
  Files          473     474       +1     
  Lines        47496   47510      +14     
  Branches       731     731              
==========================================
  Hits          1687    1687              
- Misses       45809   45823      +14     
Flag Coverage Δ
unit 3.55% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/types.ts 100.00% <ø> (ø)
...ckages/mermaid/src/diagrams/sequence/sequenceDb.ts 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link

argos-ci bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 10 added Nov 14, 2025, 7:08 AM

@omkarht omkarht marked this pull request as ready for review November 6, 2025 11:54
Copy link
Member

@sidharthv96 sidharthv96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should support this syntax. The @{ } syntax is meant to define all custom properties of a node. So shouldn't it just be ID@{ alias: 'Alias' }?

Mixing the old syntax with new seems wrong.

@omkarht omkarht requested a review from sidharthv96 November 14, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants