# OpenAPI

Reference pages from OpenAPI documents.

`@vuesho/openapi` generates reference pages from OpenAPI documents, with schemas, code samples and a playground that sends real requests. The [example](/api-docs/openapi/example/createNote) documents a few httpbin endpoints.

## Setup [#setup]

### Install the Package [#install-the-package-step]

```npm
npm i @vuesho/openapi
```

### Add the Source and Plugin [#add-the-source-and-plugin-step]

`createOpenAPI()` loads the documents, `staticSource()` returns their pages as a content source under `baseDir`, and `openapiPlugin()` renders the pages:

```ts title="vuesho.config.ts"
import { createOpenAPI, openapiPlugin } from "@vuesho/openapi";
import { createSite, recommendedPreset } from "vuesho/config";
import { defineDocs } from "vuesho/content";

const docs = defineDocs();
// A path from the project root, or a URL.
const openapi = createOpenAPI({ input: ["openapi.yaml"] });

export default createSite({
  docs: docs.toSource(),
  api: openapi.staticSource({ baseDir: "api" }), // [!code highlight]
}).plugins(recommendedPreset(), openapiPlugin());
```

Run `vuesho dev` and open a page under `/api`, like `/api/createNote` for the operation with the `operationId` `createNote`.

### Name the Folder [#name-the-folder-step]

The pages are in an `api` folder in the sidebar. To give the folder a title, add a [meta file](/navigation#folders) to the content folder:

```json title="content/api/meta.json"
{ "title": "API Reference" }
```

<Callout title="CORS">
The playground sends requests from the browser, so it reaches only an API whose CORS headers allow your site's origin. For other APIs, turn on the [proxy](#proxy).
</Callout>

## Pages [#pages]

Each operation and webhook has a page, named after its `operationId`, with its method as a badge in the sidebar. The generated pages are in search and `llms.txt`, like your other pages. `per` and `groupBy` arrange the pages into other files and folders, as the tabs show for the example:

<Tabs :items='["Default","groupBy: tag","groupBy: route","per: tag"]'>
<Tab value="Default">
```files
api
├── echoQuery.md
├── createNote.md
├── getStatus.md
└── checkBearer.md
```
</Tab>

<Tab value="groupBy: tag">
```files
api
├── requests
│   ├── echoQuery.md
│   ├── createNote.md
│   └── getStatus.md
└── auth
    └── checkBearer.md
```
</Tab>

<Tab value="groupBy: route">
```files
api
├── get
│   └── get.md
├── anything
│   └── notes
│       └── post.md
├── status
│   └── code
│       └── get.md
└── bearer
    └── get.md
```
</Tab>

<Tab value="per: tag">
```files
api
├── requests.md
└── auth.md
```
</Tab>
</Tabs>

`per: "file"` puts each document on one page. `groupBy` groups the pages in folders, and `meta: true` orders them:

```ts title="vuesho.config.ts"
openapi.staticSource({
  baseDir: "api",
  groupBy: "tag",
  // Generates the meta files, which order the pages as the document does.
  meta: true,
});
```

A tag's folder takes its title from `x-displayName`, or else from an OpenAPI 3.2 tag's `summary`. An OpenAPI 3.2 tag with a `parent` nests in its parent's folder. Operations without a tag go in an `unknown` folder:

```yaml title="openapi.yaml"
tags:
  - name: store
    x-displayName: Store
  - name: products
    parent: store
```

`badges: false` on `openapiPlugin()` removes the method badges and the strikethrough on deprecated operations from the sidebar.

## Documents [#documents]

### Multiple Documents [#multiple-documents]

A document's ID is its file name, or the last segment of its URL, without the extension. To choose the IDs, pass a record. Its values can also be document objects, or functions that return a document:

```ts title="vuesho.config.ts"
const openapi = createOpenAPI({
  input: {
    store: "openapi/store.yaml",
    billing: "https://api.example.com/openapi.json",
  },
});
```

To put each document in a separate folder, prefix the file name with `this.id` in `name`:

```ts title="vuesho.config.ts"
openapi.staticSource({
  baseDir: "api",
  per: "operation",
  name(output) {
    const slug = output.info.title.toLowerCase().replaceAll(" ", "-");
    return `${this.id}/${slug}`; // [!code highlight]
  },
});
```

<Callout type="warn" title="Trusted Documents Only">
The server reads the local files and the URLs that a document references with `$ref`, so load only documents you trust.
</Callout>

### `input` as a Function [#input-as-a-function]

`input` can be a function, called once with `onRead`. Call `onRead` with each local file it reads, like a config that lists the documents, so the built server gets those files too:

```ts title="vuesho.config.ts"
import { readFileSync } from "node:fs";

const openapi = createOpenAPI({
  input(onRead) {
    onRead("api-config.json");
    const config: { documents: string[] } = JSON.parse(readFileSync("api-config.json", "utf8"));
    return config.documents;
  },
});
```

### Live Updates [#live-updates]

`staticSource()` reads the documents when the site starts, so restart `vuesho dev` after you edit one.

`dynamicSource()` reads the documents on the server, renders the pages on request, and reads the documents again after `staleTime`, like any [dynamic source](/dynamic-rendering#dynamic-sources):

```ts title="vuesho.config.ts"
createSite({
  docs: docs.toSource(),
  api: openapi.staticSource({ baseDir: "api" }), // [!code --]
  api: openapi.dynamicSource({ baseDir: "api", staleTime: 60_000 }), // [!code ++]
});
```

Deploy a local document with the server, since `dynamicSource()` reads it there.

## Playground [#playground]

An operation's playground sends requests from the browser, with fields for the parameters, the body and the credentials of its security schemes. Configure it with the `playground` option of [`createOpenAPIPage()`](#customization), or turn it off with `playground: { enabled: false }`.

### Proxy [#proxy]

With `proxy` on `openapiPlugin()`, the playground sends its requests through `/_openapi/proxy`, a route on your site. The route renders on request, so the site needs a server:

```ts title="vuesho.config.ts"
openapiPlugin({
  proxy: { allowedOrigins: ["https://api.example.com"] },
});
```

With `proxy: true`, the proxy reaches only the documents' servers, and strips cookies. `allowedOrigins: "public"` allows any host outside private networks.

<Callout type="warn" title="Cookies">
With a list of `allowedOrigins`, the proxy forwards your site's cookies to those origins and returns their `Set-Cookie` headers, so list only origins you trust.
</Callout>

A static site can run the proxy elsewhere, like in a serverless function, with `createProxy()`:

```ts title="api/proxy.ts"
import { createOpenAPI, createProxy } from "@vuesho/openapi";

const proxy = createProxy({ openapi: createOpenAPI({ input: ["openapi.yaml"] }) });

export default { fetch: proxy.handle };
```

```ts title="vuesho.config.ts"
openapiPlugin({ proxy: { url: "/api/proxy" } });
```

### OAuth [#oauth]

An OAuth 2.0 flow that redirects returns to the page that started it, so the provider must allow the URL of every page. `oauth: true` adds one callback page instead, `/_openapi/oauth.html`, which you register with the provider. It works under a Content Security Policy of `script-src 'self'`:

```ts title="vuesho.config.ts"
openapiPlugin({ oauth: true });
```

### Authorization [#authorization]

`authProviders` replaces a security scheme's fields. `on` takes a scheme's ID, or a function that matches schemes. `render` is a component that receives the row components, like `Value`, which edits the value:

```vue title="src/BearerRows.vue"
<script setup lang="ts">
import type { AuthRenderProps } from "@vuesho/openapi/playground";

defineProps<AuthRenderProps>();
</script>

<template>
  <component :is="Value" name="Authorization" type="header" start="Bearer" />
</template>
```

```ts title="src/api-page.ts"
import { createOpenAPIPage } from "@vuesho/openapi/ui";
import BearerRows from "./BearerRows.vue";

export const OpenAPIPage = createOpenAPIPage({
  playground: { authProviders: [{ on: "bearer", render: BearerRows }] }, // [!code highlight]
});
```

For a sign-in that leaves the page, `useAuthRedirect()` from `@vuesho/openapi/playground` redirects the reader, and reads the result when they come back.

### Custom Fields [#custom-fields]

`renderParameterField` and `renderBodyField` replace a parameter's input or the body's. Return `undefined` to keep the default input, or call `renderDefault()` with another schema:

```ts title="src/api-page.ts"
import { h } from "vue";
import { createOpenAPIPage } from "@vuesho/openapi/ui";
import ColorField from "./ColorField.vue";

export const OpenAPIPage = createOpenAPIPage({
  playground: {
    renderParameterField(field, param, { renderDefault }) {
      if (param.name === "region") return renderDefault({ type: "string", enum: ["eu", "us"] });
      if (param.name === "color") return h(ColorField, { field });
    },
  },
});
```

A custom input reads and writes its value with `Custom.useController()`:

```vue title="src/ColorField.vue"
<script setup lang="ts">
import { Custom } from "@vuesho/openapi/ui/playground/client";

const props = defineProps<{ field: (string | number)[] }>();
const { value, setValue } = Custom.useController(props.field, { defaultValue: "#000000" });
</script>

<template>
  <input type="color" :value="value" @input="setValue(($event.target as HTMLInputElement).value)" />
</template>
```

### Scalar API Client [#scalar-api-client]

`withScalar()` replaces the playground with the [Scalar API Client](https://scalar.com/products/api-client/getting-started). The Scalar client sends the requests itself, so `proxy`, `oauth` and `playground` don't apply to it:

```npm
npm i @scalar/api-client @scalar/workspace-store
```

With pnpm, the install stops on the build script of `vue-demi`, which Scalar's dependencies bring. Its files already target Vue 3, so either answer works: `allowBuilds: { vue-demi: false }` in `pnpm-workspace.yaml` skips the script, and `true` runs it.

```ts title="src/api-page.ts"
import { createOpenAPIPage } from "@vuesho/openapi/ui";
import { withScalar } from "@vuesho/openapi/ui/scalar";

export const OpenAPIPage = createOpenAPIPage(withScalar({ showResponseSchema: false }));
```

The client is about 1 MB of gzipped JavaScript, which loads when a playground first renders, and its stylesheet adds about 30 kB of CSS to each API page.

## Customization [#customization]

Create the page component with your options in `createOpenAPIPage()`, and set it as the `openapi` [page body](/theme#views-and-page-bodies) in your theme:

```ts title="src/api-page.ts"
import { createOpenAPIPage } from "@vuesho/openapi/ui";

export const OpenAPIPage = createOpenAPIPage({
  // Shows only the example response and the TypeScript definitions.
  showResponseSchema: false,
  schemaUI: { showExample: true },
});
```

```ts title="src/theme.ts"
import { defineTheme } from "vuesho/theme";
import defaultTheme from "vuesho/theme/default";
import type app from "../vuesho.config";

export default defineTheme<typeof app>({
  extends: defaultTheme,
  bodies: { openapi: () => import("./api-page").then((mod) => mod.OpenAPIPage) }, // [!code highlight]
});
```

To use `<OpenAPIPage>` in Markdown with the same options, re-export it from `src/components/content/`:

```ts title="src/components/content/OpenAPIPage.ts"
export { OpenAPIPage as default } from "../../api-page";
```

On a site with several sources, give it `source`, the key in `createSite()` of the OpenAPI source.

### Code Samples [#code-samples]

An operation has samples in cURL, JavaScript, Go, Python, Java, C#, Ruby and Rust. `codeUsages` changes the languages for every operation:

```ts title="src/api-page.ts"
import { createOpenAPIPage } from "@vuesho/openapi/ui";
import { createCodeUsageGeneratorRegistry, registerDefault } from "@vuesho/openapi/requests";

const codeUsages = createCodeUsageGeneratorRegistry();
registerDefault(codeUsages);
codeUsages.add("sdk", {
  label: "SDK",
  lang: "ts",
  generate: (data) => `await client.request(${JSON.stringify(data.url)});`,
});

export const OpenAPIPage = createOpenAPIPage({ codeUsages });
```

To change one operation's samples, use `generateCodeSamples`, or add `x-codeSamples` to the operation in the document:

```yaml title="openapi.yaml"
paths:
  /notes:
    post:
      x-codeSamples:
        - lang: ts
          label: SDK
          source: 'await client.notes.create({ text: "Hello" });'
```

### Components [#components]

`components` replaces parts of the page. A layout receives the parts as named slots, so it can reorder them:

```vue title="src/OperationLayout.vue"
<script setup lang="ts">
import type { OperationLayoutProps } from "@vuesho/openapi/client";

defineProps<OperationLayoutProps>();
</script>

<template>
  <div class="flex flex-col gap-4">
    <slot name="header" />
    <slot name="description" />
    <slot name="api-playground" />
    <slot name="auth-schemes" />
    <slot name="parameters" />
    <slot name="body" />
    <slot name="responses" />
    <slot name="api-example" />
    <slot name="callbacks" />
  </div>
</template>
```

```ts title="src/api-page.ts"
import { createOpenAPIPage } from "@vuesho/openapi/ui";
import OperationLayout from "./OperationLayout.vue";

export const OpenAPIPage = createOpenAPIPage({ components: { OperationLayout } });
```

To change a part freely, copy it into `src/ui/@vuesho/openapi/` with [`vuesho add`](/cli#vuesho-add). `--from @vuesho/api-docs` copies the parts that every API integration shares, like the schemas and the playground fields:

```npm
npx vuesho add operation --from @vuesho/openapi
```

```ts title="src/api-page.ts"
import { createOpenAPIPage } from "@vuesho/openapi/ui";
import { Operation } from "./ui/@vuesho/openapi/operation";

export const OpenAPIPage = createOpenAPIPage({ components: { Operation } });
```

### Headless Usage [#headless-usage]

To build the page with a custom UI, use the headless entries: `@vuesho/openapi/client` for the document and its operations, `@vuesho/openapi/playground` for requests and credentials, `@vuesho/openapi/requests` for code samples, and `@vuesho/api-docs/json-schema` for schemas.

## Translations [#translations]

The generated pages are in each of your site's languages. The UI has language packs for `ja`, `zh-CN` and `zh-TW`, and [`ui.translations`](/i18n#ui-translations) replaces any of its texts:

```ts title="vuesho.config.ts"
createSite(sources, { i18n }).config({
  site: { languages: { cn: { lang: "zh-CN" } } },
  ui: { translations: { cn: { "Send(playground)": "发送请求" } } }, // [!code highlight]
});
```

## Options [#options]

### `staticSource()` and `dynamicSource()` [#staticsource-and-dynamicsource]

### OpenAPISourceOptions

| Prop       | Type                                                                                                                         | Description                                                                                                                                                                                                                                                        |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `per?`     | `"operation" \| undefined`                                                                                                   | Generates a page per operation, the default.                                                                                                                                                                                                                       |
| `groupBy?` | `"tag" \| "route" \| "none" \| ((entry: DistributiveOmit<OperationOutput \| WebhookOutput, "path">) => string) \| undefined` | Groups the output into folders, in `operation` mode only: - `tag`: `{tag}/{file}` - `route`: `{endpoint}/{method}`, which ignores the `name` option - `none`: `{file}` - a function that returns an entry's group name, which is the folder path Default: `'none'` |
| `name?`    | `NameFn<OperationOutput \| WebhookOutput> \| NameFnOptions \| undefined`                                                     | Names each output file.                                                                                                                                                                                                                                            |
| `slugify?` | `((name: string) => string) \| undefined`                                                                                    | Turns names into file names. By default, it only escapes whitespace and uppercase English letters.                                                                                                                                                                 |
| `baseDir?` | `string \| undefined`                                                                                                        | The folder for the pages in the site's file tree, which sets their URLs.                                                                                                                                                                                           |
| `meta?`    | `boolean \| { folderStyle?: "folder" \| "separator"; } \| undefined`                                                         | Generates meta files.                                                                                                                                                                                                                                              |

`per: "tag"` and `per: "file"` take the same options except `groupBy`. `per: "custom"` takes `toPages()` instead, which creates the pages.

### `openapiPlugin()` [#openapiplugin]

### OpenAPIPluginOptions

| Prop      | Type                                                                                                            | Description                                                                                                                                                                                                                                                     |
| --------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `proxy?`  | `true \| (ProxyOptions & { allowedOrigins?: AllowedOrigins; path?: string; }) \| { url: string; } \| undefined` | The proxy for playground requests to APIs that don't allow requests from your site: a site route, which renders on request and reaches the servers of the documents of every page, or `{ url }` for a proxy served elsewhere, like one made by `createProxy()`. |
| `oauth?`  | `true \| { path?: string; } \| undefined`                                                                       | A page that OAuth flows redirect to, `<path>.html` with its script at `<path>.js`, which sends readers back to the page that started the flow. Without it, a flow returns to its own page.                                                                      |
| `badges?` | `boolean \| undefined`                                                                                          | Shows each operation's method in the page tree, a badge on webhooks, and a line through deprecated ones. Default: `true`                                                                                                                                        |

`proxy`'s options, which `createProxy()` takes too:

### ProxyOptions

| Prop             | Type                                                                                                     | Description                                                         |
| ---------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `filterRequest?` | `((request: Request) => boolean) \| undefined`                                                           | Whether to allow the proxied request. A refused request gets a 403. |
| `overrides?`     | `{ request?: (request: Request) => Request; response?: (response: Response) => Response; } \| undefined` | Replaces the proxied request or response with yours.                |

### `createOpenAPIPage()` [#createopenapipage]

### CreateOpenAPIPageOptions

| Prop                             | Type                                                                                                                                                         | Description                                                                                                                                                                                            |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `components?`                    | `Partial<Partial<PageComponents> & { SchemaUI: Component<SchemaUIOptions>; } & OpenAPILayoutComponents> \| undefined`                                        | Replaces parts of the UI, like the ones copied with the CLI of Vuesho.                                                                                                                                 |
| `mediaAdapters?`                 | `Record<string, MediaAdapter> \| undefined`                                                                                                                  | Adapters for more media types.                                                                                                                                                                         |
| `storageKeyPrefix?`              | `string \| undefined`                                                                                                                                        | The prefix for storage keys, which keeps the state of several OpenAPI instances apart. Default: `` `vuesho-openapi-` ``                                                                                |
| `codeUsages?`                    | `CodeUsageGeneratorRegistry \| undefined`                                                                                                                    | The code usage generators for every endpoint.                                                                                                                                                          |
| `generateCodeSamples?`           | `((options: { path: string; operation: OperationObject$1; method: HttpMethods$1; pathItem: PathItemObject$1; }) => InlineCodeUsageGenerator[]) \| undefined` | Gives one endpoint's code usages.                                                                                                                                                                      |
| `generateTypeScriptDefinitions?` | `false \| ((schema: JsonSchema, ctx: GenerateTypeScriptDefinitionsContext) => Awaitable<string \| undefined>) \| undefined`                                  | Generates TypeScript definitions from a JSON schema. `false` turns them off.                                                                                                                           |
| `highlighter?`                   | `Highlighter \| (() => Highlighter \| PromiseLike<Highlighter>) \| undefined`                                                                                | The code block highlighter, or a function that loads it. Defaults to `getHighlighter()` from `vuesho/client`: the built-in highlighter with the site's code themes, loaded when a code block needs it. |
| `showResponseSchema?`            | `boolean \| undefined`                                                                                                                                       | Shows the full response schema, not only the example response and the TypeScript definitions. Default: `true`                                                                                          |
| `schemaUI?`                      | `{ showExample?: boolean; } \| undefined`                                                                                                                    | The UI that describes JSON schemas.                                                                                                                                                                    |
| `playground?`                    | `OperationPlaygroundOptions \| undefined`                                                                                                                    | The API playground.                                                                                                                                                                                    |

`playground`'s options:

### OpenAPIPlaygroundOptions

| Prop                    | Type                                                                                                                    | Description                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enabled?`              | `boolean \| undefined`                                                                                                  | Enables the interactive API playground on operation pages. Default: `true`                                                                                                                                                                                                                                                                                                  |
| `components?`           | `{ ResultDisplay?: Component<ResultDisplayProps>; } \| undefined`                                                       | Custom components inside the interactive playground.                                                                                                                                                                                                                                                                                                                        |
| `renderParameterField?` | `((fieldName: FieldKey, param: ParameterObject$1, ctx: ParameterFieldContext) => VNodeChild \| undefined) \| undefined` | Renders the input for one of the endpoint's parameters. Return `undefined` to keep the default input. `ctx.renderDefault(schema)` renders the default input with another schema, like an `enum` of values loaded at runtime. To update values, use `Custom.useController()` from `@vuesho/openapi/ui/playground/client`. The `json-schema-typed` package types the schemas. |
| `renderBodyField?`      | `((fieldName: "body", info: RequestBodyInfo) => VNodeChild) \| undefined`                                               | Renders the input for the endpoint's body.                                                                                                                                                                                                                                                                                                                                  |
| `authProviders?`        | `AuthProvider[] \| undefined`                                                                                           | Providers that handle security schemes, before the built-in providers.                                                                                                                                                                                                                                                                                                      |
| `transformAuthInputs?`  | `((fields: AuthField[]) => AuthField[]) \| undefined`                                                                   | Changes the auth fields, like their default values.                                                                                                                                                                                                                                                                                                                         |
| `fetchOptions?`         | `BrowserFetcherOptions \| undefined`                                                                                    | Options for the fetcher that sends the playground's requests in the browser.                                                                                                                                                                                                                                                                                                |

The parts that `components` replaces:

### OpenAPIPageComponents

| Prop                   | Type                                                                  | Description                                                                                                                                                                                                                                      |
| ---------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Markdown?`            | `Component<{ md: string; }> \| undefined`                             | Renders Markdown text from the API specification.                                                                                                                                                                                                |
| `CodeBlock?`           | `Component<CodeBlockProps> \| undefined`                              | Its slots `title`, `icon` and `actions` go in its title bar, like those of the code block of `vuesho`.                                                                                                                                           |
| `Heading?`             | `Component<{ id: string; depth: number; }> \| undefined`              | Its content is the default slot.                                                                                                                                                                                                                 |
| `SchemaUI?`            | `Component<SchemaUIOptions> \| undefined`                             |                                                                                                                                                                                                                                                  |
| `Operation?`           | `Component<PageOperationProps> \| undefined`                          | Renders one of the page's operations or webhooks.                                                                                                                                                                                                |
| `Layout?`              | `Component<PageLayoutProps> \| undefined`                             | Wraps the rendered operations and webhooks, with `PageLayoutProps`.                                                                                                                                                                              |
| `OperationLayout?`     | `Component<OperationLayoutProps> \| undefined`                        | An operation's layout, with the slots `header`, `description`, `api-example`, `api-playground`, `auth-schemes`, `parameters`, `body`, `responses` and `callbacks`.                                                                               |
| `WebhookLayout?`       | `Component \| undefined`                                              | A webhook's layout, with the slots `header`, `description`, `auth-schemes`, `parameters`, `body`, `requests`, `responses` and `callbacks`.                                                                                                       |
| `APIExampleLayout?`    | `Component \| undefined`                                              | An operation's examples layout, with the slots `selector`, `usage-tabs` and `response-tabs`. The `selector` slot, which selects an example request, is only used with `APIExampleUsageTabs`, since the default usage tabs put it in their title. |
| `APIExampleUsageTabs?` | `Component<{ generators: CodeUsageGeneratorRegistry; }> \| undefined` | An operation's code usages, from its generators.                                                                                                                                                                                                 |
| `ResponseTabs?`        | `Component<{ tabs: ResponseTab[]; }> \| undefined`                    | An operation's example responses.                                                                                                                                                                                                                |
| `RequestTabs?`         | `Component<RequestTabsProps> \| undefined`                            | A webhook's example requests.                                                                                                                                                                                                                    |
| `Playground?`          | `Component<APIPlaygroundProps> \| undefined`                          | Replaces the operations' playground, and receives the operation. The `playground` options only apply to the default playground.                                                                                                                  |

### `<OpenAPIPage>` [#openapipage]

### OpenAPIPageProps

| Prop               | Type                           | Description                                                                                                                                   |
| ------------------ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `document`         | `string`                       | The ID of the document in `input`.                                                                                                            |
| `source?`          | `string \| undefined`          | The key in `createSite()` of the source whose pages have the document, which a page component in Markdown needs on a site of several sources. |
| `showTitle?`       | `boolean \| undefined`         | Renders each operation's title as a heading.                                                                                                  |
| `showDescription?` | `boolean \| undefined`         | Renders each operation's description as Markdown.                                                                                             |
| `operations?`      | `OperationItem[] \| undefined` | The document's API operations to render on this page.                                                                                         |
| `webhooks?`        | `WebhookItem[] \| undefined`   | The document's webhooks to render on this page.                                                                                               |
