快速开始
import { OasDocument } from "@powerduck/oas-document/react";
import "@powerduck/oas-document/react/index.css";
const spec = {
openapi: "3.1.0",
info: { title: "My API", version: "1.0.0" },
paths: {
"/users": {
get: {
summary: "List users",
operationId: "listUsers",
tags: ["Users"],
responses: { "200": { description: "A list of users" } },
},
},
},
};
export default function App() {
return <OasDocument input={spec} style={{ height: "100vh" }} />;
}
配置页头
<OasDocument
input={spec}
header={{
logo: "https://example.com/logo.svg",
title: "My API Docs",
navItems: [
{ label: "Home", href: "/" },
{ label: "GitHub", href: "https://github.com/org/repo" },
],
showThemeToggle: true,
}}
treeWidth={340}
/>