<rapi-flow> API Reference
Draws the workflows of an Arazzo document as a diagram, and runs them against your API. It ships in its own bundle, rapidoc-flow-min.js.
Config Options
HTML Attributes#
Set on the <rapi-flow> element in HTML, or changed at runtime with setAttribute.
Workflow Attributes#8
| Attribute Name | Description & Allowed Values | Default |
|---|---|---|
URL of the Arazzo 1.x document, YAML or JSON. | (empty) | |
Replaces the URL of the first OpenAPI source description. Other sources are fetched relative to
the Arazzo file. | (empty) | |
The workflow to show. With several workflows, a picker in the header switches between them. | (the first workflow) | |
id of a <rapi-doc> or
<rapi-doc-mini> on the page, or several ids separated by
spaces, one element per OpenAPI source of the Arazzo document. Each element supplies its source's
spec, server, credentials and mock; clicking a step shows its operation in the element of its
source. An element is paired with the source its arazzo-source
attribute names, else the source whose URL it has loaded, else the next source not paired yet.
A paired <rapi-doc-mini> gets filter-operations: the shown workflow's operations of its source, in step order. | (empty) | |
Allowed: expanded shows each step's inputs and actions in its box;
compact shows the operation, the values that come from the
inputs or earlier steps, and the gotos and retries whose lines leave the box. | expanded | |
Allowed: false hides the Compact / Expanded switch. | true | |
Allowed: true shows a box above the diagram to load any Arazzo
document by URL (YAML or JSON; the server must allow cross-origin requests). Loading one shows
its first workflow. The element then manages the document: with for, whenever the document changes (from the box or arazzo-url), each paired element loads its OpenAPI source, unless it already
shows that spec, so steps resolve and runs go to that API. | false | |
Allowed: true keeps the shown workflow and the selected step in the
page's address as query parameters, ?workflow=<id>&step=<id>,
so a link opens that workflow with that step selected and scrolled into view. It uses the query
string, not the hash, which <rapi-doc> keeps for its
operations; the address is replaced (no history entries) and history.state is kept for the page's router. Set it on one element per page. | false |
Theme Attributes#2
| Attribute Name | Description & Allowed Values | Default |
|---|---|---|
Allowed: Brand color preset, or a custom brand color as a hex code. Each preset defines a dark and a
light palette. | amber | |
Allowed: Base color scheme mode. 'system' automatically matches the user's OS preference. 'auto' follows
the host page: it reads the page's CSS color-scheme (for example
:root[data-theme='light'] { color-scheme: light }, as Starlight sets it) and
updates when the page switches theme; when the page declares none, it falls back to the OS
preference. | dark |
Run Attributes#3
| Attribute Name | Description & Allowed Values | Default |
|---|---|---|
Allowed: false hides the run panel: the diagram only. | true | |
Base URL the first OpenAPI source's requests go to in runs, instead of the server its paired
element selected or the spec's first server. | (empty) | |
Allowed: true says the server runs go to is a mock that picks its
response status from a Prefer: code= header, such as
rapidoc mock or Prism. The run panel then shows Mock Response
Status, sent with each step's request, and the button reads "Run workflow (Mock)". Not needed
when the paired elements have mock-server="true"; against a real API, leave it off: the header is ignored. | false |
MCP Attributes#2
| Attribute Name | Description & Allowed Values | Default |
|---|---|---|
Allowed: true shows an Export MCP Server button that downloads an MCP
server with one tool per workflow of the Arazzo document (every one the runtime can run), and
no tool per operation. Its steps call every API source of the document; <rapi-doc>'s own export covers one API's operations. | false | |
Name of the exported MCP server. Defaults to the Arazzo document's title. | (empty) |
JavaScript API
DOM Methods#
Called on the <rapi-flow> element, for example document.querySelector('rapi-flow').
| Method Name | Description & Usage |
|---|---|
Loads the Arazzo document and its OpenAPI sources. Fires flow-loaded when done. | |
Builds the MCP server of the document's workflows: { manifest,
files, budget, hostConfig, problems }, as <rapi-doc>'s generateMcpServer, with
one tool per workflow the runtime can run and none per operation; problems says why a workflow was left out. Null until the document and its
first source are loaded. | |
Downloads that server as <server-name>-mcp.zip. |
Runtime Hooks
Lifecycle & Console Events#
CustomEvents dispatched by <rapi-flow>. Listen to them with addEventListener; the payload is in e.detail.
Event Interceptor Example
const flow = document.querySelector('rapi-flow');
// A step was clicked: show its operation somewhere else on the page
flow.addEventListener('step-click', (e) => {
console.log(e.detail.workflowId, e.detail.stepId, e.detail.operation);
});
// A run finished: one trace entry per step attempt
flow.addEventListener('workflow-run', (e) => {
console.table(e.detail.trace);
});| Event Name | Description & Payload |
|---|---|
The Arazzo document and its sources are loaded. e.detail is { doc, problems }; problems lists validation findings. | |
A step box is clicked or activated with the keyboard. e.detail is { workflowId, stepId, operation, workflowRef
}. | |
The reader switched between compact and expanded. e.detail is { view }. | |
A run finished. e.detail is { workflowId, inputs, result, trace }: result is the MCP tool result, and trace has one
entry per step attempt with its request and response. |
Component Slots
HTML Template Slots#
Put your own markup inside <rapi-flow> with a slot attribute, and it shows at that place in the element.
| Slot Name | Placement & Description |
|---|---|
Markup shown at the top, above the Arazzo document card: a logo, a title, or
controls such as a mock / real server switch. It stays in the page's DOM, so page styles and
scripts reach it. | |
Markup shown at the bottom, below the run panel: links, notes, or legal text. |