docusaurus-plugin-openapi-docs 0.0.0-615 → 0.0.0-617
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/lib/index.js +11 -1
- package/package.json +2 -2
- package/src/index.ts +11 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ The `docusaurus-plugin-openapi-docs` package extends the Docusaurus CLI with com
|
|
|
22
22
|
|
|
23
23
|
Key Features:
|
|
24
24
|
|
|
25
|
-
- **Compatible:** Works with Swagger 2.0 and OpenAPI 3.
|
|
25
|
+
- **Compatible:** Works with Swagger 2.0 and OpenAPI 3.0.
|
|
26
26
|
- **Fast:** Convert large OpenAPI specs into MDX docs in seconds. 🔥
|
|
27
27
|
- **Stylish:** Based on the same [Infima styling framework](https://infima.dev/) that powers the Docusaurus UI.
|
|
28
28
|
- **Capable:** Supports single, multi and _even micro_ OpenAPI specs.
|
|
@@ -41,6 +41,13 @@ Theme:
|
|
|
41
41
|
yarn add docusaurus-theme-openapi-docs
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
## Compatibility Matrix
|
|
45
|
+
|
|
46
|
+
| Docusaurus OpenAPI Docs | Docusaurus |
|
|
47
|
+
| ----------------------- | ---------------- |
|
|
48
|
+
| 1.x.x | `>=2.0.1 <2.3.0` |
|
|
49
|
+
| 2.x.x (beta) | `>=2.3.0 <2.4.1` |
|
|
50
|
+
|
|
44
51
|
## Configuring `docusaurus.config.js` (Plugin and theme usage)
|
|
45
52
|
|
|
46
53
|
Here is an example of properly configuring your `docusaurus.config.js` file for `docusaurus-plugin-openapi-docs` and `docusaurus-theme-openapi-docs` usage.
|
package/lib/index.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.getDocsPluginConfig = exports.isURL = void 0;
|
|
13
13
|
const fs_1 = __importDefault(require("fs"));
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const zlib_1 = __importDefault(require("zlib"));
|
|
15
16
|
const utils_1 = require("@docusaurus/utils");
|
|
16
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
18
|
const mustache_1 = require("mustache");
|
|
@@ -210,7 +211,16 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
210
211
|
: tagPageGenerator(item);
|
|
211
212
|
item.markdown = markdown;
|
|
212
213
|
if (item.type === "api") {
|
|
213
|
-
|
|
214
|
+
// opportunity to compress JSON
|
|
215
|
+
// const serialize = (o: any) => {
|
|
216
|
+
// return zlib.deflateSync(JSON.stringify(o)).toString("base64");
|
|
217
|
+
// };
|
|
218
|
+
// const deserialize = (s: any) => {
|
|
219
|
+
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
220
|
+
// };
|
|
221
|
+
item.json = zlib_1.default
|
|
222
|
+
.deflateSync(JSON.stringify(item.api))
|
|
223
|
+
.toString("base64");
|
|
214
224
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
215
225
|
if (docRouteBasePath) {
|
|
216
226
|
infoBasePath = `${docRouteBasePath}/${outputDir
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-617",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=14"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "497549c580de64c1df8b91e6b7a7f283e8defb85"
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import fs from "fs";
|
|
9
9
|
import path from "path";
|
|
10
|
+
import zlib from "zlib";
|
|
10
11
|
|
|
11
12
|
import type { LoadContext, Plugin } from "@docusaurus/types";
|
|
12
13
|
import { Globby, posixPath } from "@docusaurus/utils";
|
|
@@ -264,7 +265,16 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
264
265
|
: tagPageGenerator(item);
|
|
265
266
|
item.markdown = markdown;
|
|
266
267
|
if (item.type === "api") {
|
|
267
|
-
|
|
268
|
+
// opportunity to compress JSON
|
|
269
|
+
// const serialize = (o: any) => {
|
|
270
|
+
// return zlib.deflateSync(JSON.stringify(o)).toString("base64");
|
|
271
|
+
// };
|
|
272
|
+
// const deserialize = (s: any) => {
|
|
273
|
+
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
274
|
+
// };
|
|
275
|
+
item.json = zlib
|
|
276
|
+
.deflateSync(JSON.stringify(item.api))
|
|
277
|
+
.toString("base64");
|
|
268
278
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
269
279
|
if (docRouteBasePath) {
|
|
270
280
|
infoBasePath = `${docRouteBasePath}/${outputDir
|