Skip to content

overview

The Starlight OpenAPI plugin generates documentation using OpenAPI specifications.

Quick Setup

Include import

astro.config.mjs (import)
import starlightOpenAPI, { openAPISidebarGroups } from "starlight-openapi";

Add to plugins

astro.config.mjs (plugin)
plugins: [
// Generate the OpenAPI documentation pages.
starlightOpenAPI([
{
base: "api/openai",
label: "openAI",
schema: "./src/assets/openapi-documents/openai.yaml",
},
{
base: "api/pokeapi",
label: "PokeAPI",
schema: "./src/assets/openapi-documents/pokeapi.yaml",
},
]),
],

Include in the sidebar

astro.config.mjs (sidebar)
sidebar: [
{
label: "OpenAPI",
items: [
{
label: "starlight-openapi",
items: [
,"starlight-openapi",
...openAPISidebarGroups
],
},
{
label: "Stoplight Elements",
autogenerate: { directory: "openapi/stoplight-elements" },
},
{
label: "RapiDoc",
autogenerate: { directory: "openapi/rapidoc" },
},
],
},
],