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.
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 through | Does not | |
|---|---|---|
| Operations | Real paths and methods | |
| Participants | From tags and servers | |
| Parameters | On the message | Full schemas, which would swamp it |
| Response codes | As alternative branches | |
| Authentication | As a boundary or preliminary step | |
| Ordering | Not in the spec, you describe it | |
| Retries and timeouts | Client behaviour, you describe it | |
| Webhooks | As inbound messages |
The prompt
Questions
Related
- Convert Code to a DiagramThe general case: point it at code and get a diagram of what is there rather than what you remember building.
- Convert a Diagram into CodeThe direction almost nothing else does: the diagram stops being documentation and becomes the instruction.
- Convert Terraform to an Architecture DiagramTerraform records dependencies explicitly through references, so the edges are read rather than inferred. It is one of the most reliable sources there is.
- Convert Mermaid to ExcalidrawUseful when a Mermaid diagram has outgrown what Mermaid's layout can render legibly.