Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
820fa2c
Run 'npm add docusaurus-theme-openapi-docs'
b-long Jun 5, 2025
3e71327
Add helper commands to package.json
b-long Jun 5, 2025
e6f94c7
Document helper commands
b-long Jun 5, 2025
74742ab
WIP: minimal ~working configuration
b-long Jun 5, 2025
ca09ba4
WIP: Using local swagger files
b-long Jun 6, 2025
9c1f610
WIP: Configuration
b-long Jun 6, 2025
b4824ab
Adjust 'vale' config
b-long Jun 6, 2025
8eae92e
Disable false-positive machine
b-long Jun 6, 2025
a1af6a5
Hard-code to each using the same outputDir
b-long Jun 6, 2025
d549381
Build dynamically, allows disabling DEFAULT_OPENAPI_SIDEBAR_OPTIONS
b-long Jun 6, 2025
bf50877
Use YAML instead of JSON
b-long Jun 6, 2025
c2bdfe9
Revert: Use YAML instead of JSON
b-long Jun 6, 2025
a902747
Add generated content
b-long Jun 6, 2025
8f1b2f7
Use original (vendored) openapi specs
b-long Jun 9, 2025
d846b41
package.json that works
b-long Jun 9, 2025
648fb16
Add a preprocessing to fill OpenTDF openapi gaps
b-long Jun 9, 2025
91e02cc
Add 'launch.json' file for debugging build pipeline
b-long Jun 10, 2025
4332948
Remove commented code
b-long Jun 10, 2025
0b7e701
Add openapi.json
b-long Jun 10, 2025
dc07376
Add option to include timestamp in OpenAPI description during preproc…
b-long Jun 10, 2025
5895cb1
Update output & base64-encoded OpenAPI spec
b-long Jun 10, 2025
f6231b2
Control languages shown in the UI
b-long Jun 10, 2025
de35a5e
Add sample files, to help debugging
b-long Jun 11, 2025
9e9ac8e
Use sample files, to help debugging
b-long Jun 11, 2025
1b6e511
Declare 'sampleConfig' at the start
b-long Jun 11, 2025
af1774c
Move languages to distinct file
b-long Jun 11, 2025
8309a53
specify 'outputDir' explicitly
b-long Jun 11, 2025
b987fed
Comment sidebar
b-long Jun 11, 2025
eb23e64
Remove cruft
b-long Jun 11, 2025
143ed20
Explicitly state 'sidebarOptions'
b-long Jun 11, 2025
2ebd313
Cleanup
b-long Jun 11, 2025
73a70a6
Remove old generated content
b-long Jun 11, 2025
4d47ba2
Cleanup
b-long Jun 11, 2025
2e30edb
Don't use spaces in outputDir
b-long Jun 11, 2025
e4f7ec1
Add sample files, to help debugging
b-long Jun 11, 2025
49ed163
Add sample files, to help debugging
b-long Jun 11, 2025
e14e675
Fix preprocessing
b-long Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/vale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Vale
on:
pull_request:
branches:
- main
- disabled

jobs:
vale-check:
Expand Down
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug gen-api-docs-all",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "gen-api-docs-all"],
"cwd": "${workspaceFolder}",
"skipFiles": [
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"console": "integratedTerminal"
}
]
}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ $ npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Building API docs

```
# Based on:
# https://docusaurus-openapi.tryingpan.dev/#generating-openapi-docs

# Generation
$ npm run gen-api-docs-all

# Cleanup
$ npm run gen-api-docs-clean
```
43 changes: 40 additions & 3 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ import type { Config } from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";
import matter from "gray-matter";
import listRemote from "./docusaurus-lib-list-remote";
import { openApiSpecs, preprocessOpenApiSpecs } from "./preprocessing"
import { ApiPageMetadata, SchemaPageMetadata, SidebarOptions } from "docusaurus-plugin-openapi-docs/src/types";
import type * as Plugin from "@docusaurus/types/src/plugin";
import languageTabs from "./openapi-generated-sdks";

// --- OpenAPI Config Helper ---

// Run the preprocessor before generating the config
preprocessOpenApiSpecs();

// Dynamically build the OpenAPI plugin configuration
const openApiDocsConfig: Plugin.PluginOptions = {};

openApiSpecs.forEach((spec) => {
const outputDir = spec.outputDir;

openApiDocsConfig[spec.id] = {
specPath: spec.specPathModified || spec.specPath,
outputDir,
};
});

// --- End OpenAPI Config Helper ---

const otdfctl = listRemote.createRepo("opentdf", "otdfctl", "main");

Expand Down Expand Up @@ -44,12 +67,13 @@ const config: Config = {
},
],

onBrokenLinks: "throw",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
onBrokenAnchors: "warn",
markdown: {
mermaid: true,
},
themes: ["@docusaurus/theme-mermaid", "docusaurus-theme-github-codeblock"],
themes: ["@docusaurus/theme-mermaid", "docusaurus-theme-github-codeblock", "docusaurus-theme-openapi-docs"],

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
Expand All @@ -66,7 +90,8 @@ const config: Config = {
{
docs: {
routeBasePath: "/",
sidebarPath: "./sidebars.js",
sidebarPath: require.resolve("./sidebars.js"),
docItemComponent: "@theme/ApiItem", // Derived from docusaurus-theme-openapi
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
Expand Down Expand Up @@ -192,6 +217,8 @@ const config: Config = {
// template: '#zoom-template',
// },
},

languageTabs: languageTabs,
} satisfies Preset.ThemeConfig,
plugins: [
[
Expand Down Expand Up @@ -735,6 +762,16 @@ ${updatedContent}`,
},
},
],
[
"docusaurus-plugin-openapi-docs",
{
id: "api", // plugin id
docsPluginId: "classic", // configured for preset-classic
config: openApiDocsConfig // finalConfiguration
// config: openApiDocsConfig satisfies Plugin.PluginOptions, // Use the dynamically generated config

},
],
require.resolve("docusaurus-lunr-search"),
],
};
Expand Down
96 changes: 96 additions & 0 deletions openapi-generated-sdks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
const languageTabs = [
{
highlight: "python",
language: "python",
logoClass: "python",
},
{
highlight: "bash",
language: "curl",
logoClass: "curl",
},
{
highlight: "csharp",
language: "csharp",
logoClass: "csharp",
},
// {
// highlight: "go",
// language: "go",
// logoClass: "go",
// },
// {
// highlight: "javascript",
// language: "nodejs",
// logoClass: "nodejs",
// },
{
highlight: "ruby",
language: "ruby",
logoClass: "ruby",
},
{
highlight: "php",
language: "php",
logoClass: "php",
},
// {
// highlight: "java",
// language: "java",
// logoClass: "java",
// variant: "unirest",
// },
{
highlight: "powershell",
language: "powershell",
logoClass: "powershell",
},
{
highlight: "dart",
language: "dart",
logoClass: "dart",
},
// {
// highlight: "javascript",
// language: "javascript",
// logoClass: "javascript",
// },
{
highlight: "c",
language: "c",
logoClass: "c",
},
{
highlight: "objective-c",
language: "objective-c",
logoClass: "objective-c",
},
{
highlight: "ocaml",
language: "ocaml",
logoClass: "ocaml",
},
{
highlight: "r",
language: "r",
logoClass: "r",
},
{
highlight: "swift",
language: "swift",
logoClass: "swift",
},
{
highlight: "kotlin",
language: "kotlin",
logoClass: "kotlin",
},
{
highlight: "rust",
language: "rust",
logoClass: "rust",
},
];

// export it
export default languageTabs;
Loading