Quickstart
At the end, a workflow is drawn above its API reference, and you run it against a mock that answers from the OpenAPI spec. You need a browser and an internet connection: the page loads RapiDoc and RapiFlow from unpkg and the sample files from rapidocui.com, so you can open it directly from disk.
-
Create an HTML file that loads RapiDoc and RapiFlow, and points them at the Petstore’s OpenAPI spec and its Arazzo spec (an Arazzo spec describes multi-step workflows across the operations of OpenAPI specs):
index.html <!doctype html><html lang="en"><head><meta charset="utf-8" /><title>Petstore workflows</title><script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script><script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-flow-min.js"></script><style>rapi-doc { height: 100vh; }</style></head><body><rapi-flowarazzo-url="https://rapidocui.com/specs/petstore.arazzo.yaml"workflow-id="adoptPet"for="petstore"></rapi-flow><rapi-docid="petstore"spec-url="https://rapidocui.com/specs/petstore.yaml"mock-server="true"></rapi-doc></body></html>for="petstore"pairs the two: RapiFlow takes the OpenAPI spec, the server and the credentials from the<rapi-doc>with that id.mock-server="true"on that element makes the in-browser mock answer the workflow’s requests. -
Open it in a browser. The
adoptPetworkflow is drawn as one box per step: find an available pet, check it, order it, read the order back. Each box shows the operation it calls, the values it passes on and where it goes on success or failure. The picker at the top of<rapi-flow>switches between the file’s four workflows;workflow-idpicks the one shown first. Click a step, then scroll down: the reference below shows its operation. -
Press RUN WORKFLOW (Mock). Leave the inputs as they are. The Execution Log adds a row for each step: the step, its method and URL,
HTTP 200and ✓. Open a row to see the response (and, forplaceOrder, the request body). At the end, the workflow’s outputs appear: the pet’s name, and the order’s id and status. -
Make a step retry. Open Mock Response Status, type
503, 200in theplaceOrderrow and run again. The first attempt atplaceOrdergets a 503, and its row shows ✗ and→ retry. The step’sretryaction waits two seconds, and the second attempt gets a 200: its row shows ✓, and opening it showsattempt 2. -
End the workflow early. Clear the
placeOrderrow, type404in the Every step row and run once more:findAvailablefails, and itsonFailureaction ends the workflow there. Its row shows ✗ and opens to show the failed check and→ end, and an error saying the workflow failed atfindAvailabletakes the place of the outputs.
Your own files
Section titled “Your own files”- Set
spec-urlon<rapi-doc>to your OpenAPI spec. - Set
arazzo-urlon<rapi-flow>to an Arazzo spec that lists that OpenAPI spec in itssourceDescriptions, the OpenAPI specs the workflow calls. See Pairing. - Remove
workflow-idto show the first workflow. - Serve the page and both files from a local web server: a page opened from disk can’t read files next to it. Files on another domain need a server that allows cross-origin requests.
Against the real API
Remove mock-server="true" and the same run calls the API at the OpenAPI spec’s server, from the browser, with the credentials entered in the reference’s Authentication section. That API must allow cross-origin requests from your page.
With a bundler
Section titled “With a bundler”Install rapidoc and replace the two script tags with these imports:
npm install rapidocimport 'rapidoc';import 'rapidoc/flow';Next steps
Section titled “Next steps”- Pairing with
<rapi-doc>: workflows that call several APIs, one element per API, and links to a step. - Running Workflows: what runs, the mock’s status codes, and running against RapiMock.
- Arazzo Extensions: credentials in the workflow, calls outside the API sources.
- Slots & Styling: your own header and footer, CSS parts and properties.
- API Reference: every attribute, method, event and slot of
<rapi-flow>. - RapiFlow feature page: a live demo.