Skip to content

Commit

Permalink
docs: Generate OpenAPI docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Oct 20, 2024
1 parent 3c1ec3a commit 6ffa51d
Show file tree
Hide file tree
Showing 6 changed files with 2,927 additions and 784 deletions.
20 changes: 15 additions & 5 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import type * as OpenApiPlugin from "docusaurus-preset-openapi";

const config: Config = {
title: 'Hoarder Docs',
Expand All @@ -15,8 +16,8 @@ const config: Config = {

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'MohamedBassem', // Usually your GitHub org/user name.
projectName: 'hoarder-app', // Usually your repo name.
organizationName: 'hoarder-app', // Usually your GitHub org/user name.
projectName: 'hoarder', // Usually your repo name.

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
Expand All @@ -31,19 +32,23 @@ const config: Config = {

presets: [
[
'classic',
{
'docusaurus-preset-openapi',
({
docs: {
sidebarPath: './sidebars.ts',
editUrl:
'https://github.com/hoarder-app/hoarder/tree/main/docs/',
routeBasePath: "/",
},
api: {
path: "../packages/open-api/hoarder-openapi-spec.json",
routeBasePath: '/api',
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
}) satisfies OpenApiPlugin.Options,
],
],

Expand All @@ -62,6 +67,11 @@ const config: Config = {
type: 'docsVersionDropdown',
position: 'right',
},
{
to: '/api',
label: 'API',
position: 'right',
},
{
href: 'https://hoarder.app',
label: 'Homepage',
Expand Down
13 changes: 7 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@docusaurus/core": "3.5.2",
"@docusaurus/preset-classic": "3.5.2",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.1.0",
"docusaurus-preset-openapi": "^0.7.5",
"prism-react-renderer": "^2.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.1.1",
"@docusaurus/tsconfig": "3.1.1",
"@docusaurus/types": "3.1.1",
"@docusaurus/module-type-aliases": "3.5.2",
"@docusaurus/tsconfig": "3.5.2",
"@docusaurus/types": "3.5.2",
"typescript": "^5.3.3"
},
"browserslist": {
Expand All @@ -41,7 +42,7 @@
"last 5 safari version"
]
},
"eslintConfig": {
"eslintConfig": {
"root": true,
"extends": [
"@hoarder/eslint-config/base",
Expand Down
Loading

0 comments on commit 6ffa51d

Please sign in to comment.