UML & Class Diagrams
Render Mermaid.js diagrams in your API Docs.printing press renders Mermaid.js content in two ways:
- Fenced code blocks in OpenAPI markdown descriptions.
- Auto-generated class diagrams on model pages when schema relationships exist.
Mermaid in markdown
Put a Mermaid fenced code block in any OpenAPI field that supports markdown, such as info.description, operation descriptions, or schema descriptions.
```mermaid
graph TD
Search --> Book
Book --> Pay
```
printing press will turn that fence into a rendered Mermaid block with a plain code fallback.
mermaid. Empty Mermaid fences are ignored.Generated class diagrams
Model pages will include generated Mermaid class diagrams for complex schemas with one or more relationships.
Some common relationship sources include:
- Direct
$refproperties - Array items that reference another schema
- Composed schemas using
allOf, anyOf, oneOf
Simple scalar schemas and flat objects with only primitive properties do not get generated class diagrams. Not because we can’t, but because there is no point.
BookingPayment class.Dependency explorer
Model pages may also include a dependency explorer when graph data is available.
When both a generated class diagram and graph data are present, printing press shows both views in tabs:
CLASS DIAGRAMDEPENDENCY EXPLORER