docusaurus-plugin-openapi-docs 2.0.0-beta.3 → 2.0.0-beta.4
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 +1 -1
- package/lib/index.js +11 -1
- package/lib/markdown/createRequestSchema.d.ts +1 -8
- package/lib/markdown/createRequestSchema.js +4 -643
- package/lib/markdown/createResponseSchema.d.ts +1 -8
- package/lib/markdown/createResponseSchema.js +3 -644
- package/lib/markdown/createSchema.d.ts +12 -0
- package/lib/markdown/createSchema.js +647 -0
- package/lib/markdown/index.js +3 -3
- package/lib/openapi/createRequestExample.js +3 -3
- package/lib/openapi/createResponseExample.js +3 -3
- package/package.json +2 -2
- package/src/index.ts +11 -1
- package/src/markdown/createRequestSchema.ts +2 -841
- package/src/markdown/createResponseSchema.ts +2 -843
- package/src/markdown/createSchema.ts +850 -0
- package/src/markdown/index.ts +3 -3
- package/src/openapi/createRequestExample.ts +1 -1
- package/src/openapi/createResponseExample.ts +1 -1
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.sampleRequestFromSchema = void 0;
|
|
13
13
|
const chalk_1 = __importDefault(require("chalk"));
|
|
14
14
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
15
|
-
const
|
|
15
|
+
const createSchema_1 = require("../markdown/createSchema");
|
|
16
16
|
const primitives = {
|
|
17
17
|
string: {
|
|
18
18
|
default: () => "string",
|
|
@@ -51,7 +51,7 @@ function sampleRequestFromProp(name, prop, obj) {
|
|
|
51
51
|
obj[name] = (0, exports.sampleRequestFromSchema)(prop.anyOf[0]);
|
|
52
52
|
}
|
|
53
53
|
else if (prop.allOf) {
|
|
54
|
-
const { mergedSchemas } = (0,
|
|
54
|
+
const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(prop.allOf);
|
|
55
55
|
sampleRequestFromProp(name, mergedSchemas, obj);
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
@@ -86,7 +86,7 @@ const sampleRequestFromSchema = (schema = {}) => {
|
|
|
86
86
|
return (0, exports.sampleRequestFromSchema)(anyOf[0]);
|
|
87
87
|
}
|
|
88
88
|
if (allOf) {
|
|
89
|
-
const { mergedSchemas } = (0,
|
|
89
|
+
const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(allOf);
|
|
90
90
|
if (mergedSchemas.properties) {
|
|
91
91
|
for (const [key, value] of Object.entries(mergedSchemas.properties)) {
|
|
92
92
|
if ((value.readOnly && value.readOnly === true) || value.deprecated) {
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.sampleResponseFromSchema = void 0;
|
|
13
13
|
const chalk_1 = __importDefault(require("chalk"));
|
|
14
14
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
15
|
-
const
|
|
15
|
+
const createSchema_1 = require("../markdown/createSchema");
|
|
16
16
|
const primitives = {
|
|
17
17
|
string: {
|
|
18
18
|
default: () => "string",
|
|
@@ -51,7 +51,7 @@ function sampleResponseFromProp(name, prop, obj) {
|
|
|
51
51
|
obj[name] = (0, exports.sampleResponseFromSchema)(prop.anyOf[0]);
|
|
52
52
|
}
|
|
53
53
|
else if (prop.allOf) {
|
|
54
|
-
const { mergedSchemas } = (0,
|
|
54
|
+
const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(prop.allOf);
|
|
55
55
|
sampleResponseFromProp(name, mergedSchemas, obj);
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
@@ -68,7 +68,7 @@ const sampleResponseFromSchema = (schema = {}) => {
|
|
|
68
68
|
return example;
|
|
69
69
|
}
|
|
70
70
|
if (allOf) {
|
|
71
|
-
const { mergedSchemas } = (0,
|
|
71
|
+
const { mergedSchemas } = (0, createSchema_1.mergeAllOf)(allOf);
|
|
72
72
|
if (mergedSchemas.properties) {
|
|
73
73
|
for (const [key, value] of Object.entries(mergedSchemas.properties)) {
|
|
74
74
|
if ((value.writeOnly && value.writeOnly === true) ||
|
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": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d7c1319c7977c3e7c54827b3950e5c9b66106e30"
|
|
64
64
|
}
|
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";
|
|
@@ -244,7 +245,16 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
247
|
if (item.type === "api") {
|
|
247
|
-
|
|
248
|
+
// opportunity to compress JSON
|
|
249
|
+
// const serialize = (o: any) => {
|
|
250
|
+
// return zlib.deflateSync(JSON.stringify(o)).toString("base64");
|
|
251
|
+
// };
|
|
252
|
+
// const deserialize = (s: any) => {
|
|
253
|
+
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
254
|
+
// };
|
|
255
|
+
item.json = zlib
|
|
256
|
+
.deflateSync(JSON.stringify(item.api))
|
|
257
|
+
.toString("base64");
|
|
248
258
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
249
259
|
if (docRouteBasePath) {
|
|
250
260
|
infoBasePath = `${docRouteBasePath}/${outputDir
|