Skip to content

RapiDoc Mini

<rapi-doc> is a whole API reference with navigation and search. <rapi-doc-mini> shows only the operations you pick, with their parameters, schemas and Try console, so you can put a working endpoint in the middle of a tutorial, changelog or wiki page without an <iframe>. It is in the same bundle as <rapi-doc>.

Point spec-url at your spec and choose operations with filter-operations:

<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
<rapi-doc-mini
spec-url="https://petstore.swagger.io/v2/swagger.json"
filter-operations="GET /pet/{petId}"
></rapi-doc-mini>

filter-operations is a list of terms, separated by spaces or commas. An operation is shown when it matches any term (every operation is, when there is none) and no term that starts with !.

Term Shows
getPetById The operation with that operationId (exact, case-sensitive).
GET /pet/{petId} That method and path.
/pet/{petId} Every method on that path.
/pet/*, /pet/** Paths matching the glob: * is one path segment, ** any number of segments, /pet itself included.
tag:store Operations with that tag. Quote a name with spaces: tag:"Pet Store".
badge:Beta Operations with that x-badges label, or an OpenAPI 3.2 tag of kind: badge (by its label or name).
deprecated Deprecated operations.
!<term> Leaves out what the term matches, as in !badge:Internal or !deprecated.

Methods, paths, tags and badge labels are compared without case. Paths are matched whole, never as part of a longer path: POST /user does not show POST /user/createWithList; use /user/** for everything under /user.

An operationId is matched only when the term is none of the other kinds: an id that starts with tag: or badge:, or is the word deprecated, is read as that kind instead. Select such an operation by its method and path (GET /path).

allow-try takes the same terms, to turn Try on only for the operations they select: allow-try="!deprecated !tag:pending-implementation". The operations they leave out keep their request documentation and show a disabled TRY DISABLED button.

The operations are shown in the order of the first term they match, so a list of operationIds keeps its order, unless sort-endpoints-by is set:

<rapi-doc-mini
spec-url="https://petstore.swagger.io/v2/swagger.json"
filter-operations="placeOrder getOrderById"
></rapi-doc-mini>
<!-- Everything tagged store, except the delete -->
<rapi-doc-mini
spec-url="https://petstore.swagger.io/v2/swagger.json"
filter-operations="tag:store !DELETE /store/order/{orderId}"
></rapi-doc-mini>
<rapi-doc-mini
spec-url="/specs/reqres.yaml"
filter-operations="GET /users/{userId} POST /users"
schema-style="table"
></rapi-doc-mini>

If the spec can’t be loaded, the element renders nothing and logs the error to the browser console.

showOperation(operation) expands one operation and scrolls it into view. Pass its operationId or its method and path; it resolves to false when the element does not show that operation (the spec is not loaded yet, or filter-operations leaves it out).

await document.querySelector('rapi-doc-mini').showOperation('GET /pet/{petId}');

<rapi-flow> pairs with one <rapi-doc-mini> per API its Arazzo workflow calls. Name the API with arazzo-source; <rapi-flow> then sets the mini’s filter-operations to the workflow’s calls to that API, in step order, and clicking a step shows its operation in the mini.

<rapi-flow arazzo-url="/workflows/ship-a-parcel.arazzo.yaml" for="rates-api shipments-api"></rapi-flow>
<rapi-doc-mini id="rates-api" arazzo-source="rates" spec-url="/specs/rates.yaml"></rapi-doc-mini>
<rapi-doc-mini id="shipments-api" arazzo-source="shipments" spec-url="/specs/shipments.yaml"></rapi-doc-mini>

Every attribute, method and event, grouped by what it changes, is on the <rapi-doc-mini> API reference, read from the element’s source.

Feature / Goal<rapi-doc><rapi-doc-mini>
Best forA complete API reference, on its own pageOne or a few endpoints inside a blog post, tutorial or changelog
Navigation sidebar and searchYesNo
URL hash routingYes (update-route)No: never changes the page URL
Tag names and descriptionsAlways: tags are its sections and sidebar groupsOff by default (show-tags="true" turns them on)
Try consoleYesYes
SizingFills the height you give it, usually the viewportGrows with its content inside any container
Render modesread, view and focusedOne: the matched operations