feat: adds openapi documentation
This commit is contained in:
parent
5ee45209d8
commit
b066849d90
6 changed files with 4041 additions and 2 deletions
|
@ -4,6 +4,7 @@ pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
|
- npm run docusaurus gen-api-docs api
|
||||||
- npm run build
|
- npm run build
|
||||||
- cp -r static/* build/
|
- cp -r static/* build/
|
||||||
- mv build public
|
- mv build public
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {themes as prismThemes} from 'prism-react-renderer';
|
import {themes as prismThemes} from 'prism-react-renderer';
|
||||||
import type {Config} from '@docusaurus/types';
|
import type {Config} from '@docusaurus/types';
|
||||||
import type * as Preset from '@docusaurus/preset-classic';
|
import type * as Preset from '@docusaurus/preset-classic';
|
||||||
|
import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
|
||||||
|
|
||||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ const config: Config = {
|
||||||
{
|
{
|
||||||
docs: {
|
docs: {
|
||||||
sidebarPath: './sidebars.ts',
|
sidebarPath: './sidebars.ts',
|
||||||
|
docItemComponent: "@theme/ApiItem",
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
customCss: './src/css/custom.css',
|
customCss: './src/css/custom.css',
|
||||||
|
@ -37,6 +39,28 @@ const config: Config = {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
'docusaurus-plugin-openapi-docs',
|
||||||
|
{
|
||||||
|
id: "api", // plugin id
|
||||||
|
docsPluginId: "classic", // configured for preset-classic
|
||||||
|
config: {
|
||||||
|
api: {
|
||||||
|
specPath: "static/openapi.json",
|
||||||
|
outputDir: "docs/api/",
|
||||||
|
downloadUrl: "/openapi.json",
|
||||||
|
sidebarOptions: {
|
||||||
|
groupPathsBy: "tag",
|
||||||
|
categoryLinkSource: "tag",
|
||||||
|
},
|
||||||
|
} satisfies OpenApiPlugin.Options,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
],
|
||||||
|
themes: ["docusaurus-theme-openapi-docs"], // export theme components
|
||||||
|
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
// Replace with your project's social card
|
// Replace with your project's social card
|
||||||
image: 'img/docusaurus-social-card.jpg',
|
image: 'img/docusaurus-social-card.jpg',
|
||||||
|
@ -53,6 +77,12 @@ const config: Config = {
|
||||||
position: 'left',
|
position: 'left',
|
||||||
label: 'Docs',
|
label: 'Docs',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'docSidebar',
|
||||||
|
sidebarId: 'apisidebar',
|
||||||
|
position: 'left',
|
||||||
|
label: 'API',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
to: '/contact',
|
to: '/contact',
|
||||||
position: 'left',
|
position: 'left',
|
||||||
|
|
4004
package-lock.json
generated
4004
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -20,6 +20,8 @@
|
||||||
"@docusaurus/preset-classic": "3.7.0",
|
"@docusaurus/preset-classic": "3.7.0",
|
||||||
"@mdx-js/react": "^3.0.0",
|
"@mdx-js/react": "^3.0.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
|
"docusaurus-plugin-openapi-docs": "^4.4.0",
|
||||||
|
"docusaurus-theme-openapi-docs": "^4.4.0",
|
||||||
"prism-react-renderer": "^2.3.0",
|
"prism-react-renderer": "^2.3.0",
|
||||||
"react": "^18.0.0",
|
"react": "^18.0.0",
|
||||||
"react-dom": "^18.0.0"
|
"react-dom": "^18.0.0"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||||
|
import * as apiSidebar from './docs/api/sidebar';
|
||||||
|
|
||||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||||
|
|
||||||
|
@ -14,8 +15,8 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||||
*/
|
*/
|
||||||
const sidebars: SidebarsConfig = {
|
const sidebars: SidebarsConfig = {
|
||||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
tutorialSidebar: ['intro', {'label': "Censorship 101", 'type': "category", items: [{'type': 'autogenerated', dirName: 'censorship'}]}],
|
||||||
|
apisidebar: apiSidebar.default,
|
||||||
// But you can create a sidebar manually
|
// But you can create a sidebar manually
|
||||||
/*
|
/*
|
||||||
tutorialSidebar: [
|
tutorialSidebar: [
|
||||||
|
|
1
static/openapi.json
Normal file
1
static/openapi.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue