Convert

Convert an OpenAPI spec into a sequence diagram.

The spec supplies the operations and their exact names. You supply the ordering, because a spec describes endpoints and not journeys.

Download for macOS
v0.1.33 · .dmg · Apple Silicon & Intel
Signed & notarized by Apple · opens without a Gatekeeper warning
sha256 698955a0187bc039f4c74f5d05a9f10fbb27376a45788a0a241d1326b73873c7
Download for Windows instead
$curl -fsSL https://lucidtrain.com/install.sh | sh

What the spec gives you

Accurate participants, operation names, parameters and response codes. That accuracy is the point: a sequence diagram with invented endpoint names is worse than none, because it looks authoritative and misleads anyone implementing against it.

What you have to supply

The ordering. An OpenAPI document describes what endpoints exist, not which a client calls in what sequence to accomplish something, and no amount of reading will recover that. Describing the flow in a sentence is the input; the spec keeps the details honest.

Failure branches are the valuable part

Response codes in the spec tell you what can go wrong, and drawing the alternative path, what the client does on a 409 or a 429, is usually the content someone actually needed. Happy-path-only sequence diagrams are common and are the least useful version of this artifact.

Fidelity

Comes throughDoes not
OperationsReal paths and methods
ParticipantsFrom tags and servers
ParametersOn the messageFull schemas, which would swamp it
Response codesAs alternative branches
AuthenticationAs a boundary or preliminary step
OrderingNot in the spec, you describe it
Retries and timeoutsClient behaviour, you describe it
WebhooksAs inbound messages

The prompt

shell
$ Using this OpenAPI spec, draw a sequence diagram for checkout: create the order, take payment, confirm, and show what happens when payment is declined.
FAQ

Questions

Swagger 2 or OpenAPI 3?

Both, in JSON or YAML.

Can it work out the flow itself?

It will propose a plausible one, and plausible is the risk: the spec does not contain the answer, so check it rather than trusting it.

What about GraphQL?

It works, and the type graph is arguably a better source since relationships are explicit rather than implied by shared references.

Related