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

Adds basic sequence diagrams behind a layout flag #219

Merged
merged 7 commits into from
Nov 28, 2022

Conversation

ejulio-ts
Copy link
Contributor

@ejulio-ts ejulio-ts commented Nov 26, 2022

Adds d2sequence layout for sequence diagrams with basic functionality.
The layout is behind a flag for now as it will need changes in D2 for full support. So, to merge these changes in small PRs, lets have it behind a flag that also allows us to test it locally without much friction.

Assumptions:

  • edges are kept in order as they are defined
  • object order is identified as they appear in edge order
  • the lifeline edge follows the shape stroke style, except for stroke-dash that is constant

No changelog as this is not ready yet. Will add the line once we got it properly integrated.

here is an example diagram

alice: "Alice\nline\nbreaker" {
    shape: person
    style.stroke: red
}
bob: "Bob" {
    shape: person
    style.stroke-width: 5
}
db: {
    shape: cylinder
}
queue: {
    shape: queue
}
service: "an\nodd\nservice\nwith\na\nname\nin\nmultiple lines"

alice -> bob: "Authentication Request"
bob -> service: "make request"
service -> db: "validate credentials"
db -> service: {
    style.stroke-dash: 4
}
service -> bob: {
    style.stroke-dash: 4
}
bob -> alice: "Authentication Response"
alice -> bob: "Another authentication Request"
bob -> queue: "do it later"
queue -> bob: "stored" {
    style.stroke-dash: 3
    style.stroke-width: 5
    style.stroke: green
}
bob -> alice: "Another authentication Response"

_Users_juliobatista_Projects_terrastruct_d2_temp svg (1)

Updates #99

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

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

let's introduce sequence-diagram-specific terminology, starting with s/object/actor

@ejulio-ts ejulio-ts requested a review from alixander November 28, 2022 19:42
@ejulio-ts
Copy link
Contributor Author

_Users_juliobatista_Projects_terrastruct_d2_temp svg (2)

@ejulio-ts ejulio-ts requested a review from alixander November 28, 2022 21:19
@ejulio-ts ejulio-ts merged commit 3b3c072 into terrastruct:master Nov 28, 2022
@ejulio-ts ejulio-ts deleted the basic-sequence-diagrams branch November 28, 2022 21:31
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

Successfully merging this pull request may close these issues.

2 participants