docusaurus-plugin-openapi-docs 0.0.0-beta.639 → 0.0.0-beta.641
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/lib/index.js +6 -6
- package/lib/markdown/createAuthorization.d.ts +1 -0
- package/lib/markdown/createAuthorization.js +16 -0
- package/lib/markdown/index.d.ts +1 -1
- package/lib/markdown/index.js +4 -1
- package/package.json +2 -2
- package/src/index.ts +7 -7
- package/src/markdown/createAuthorization.ts +13 -0
- package/src/markdown/index.ts +4 -0
package/lib/index.js
CHANGED
|
@@ -199,12 +199,6 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
199
199
|
item.downloadUrl = downloadUrl;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const markdown = item.type === "api"
|
|
203
|
-
? (0, markdown_1.createApiPageMD)(item)
|
|
204
|
-
: item.type === "info"
|
|
205
|
-
? (0, markdown_1.createInfoPageMD)(item)
|
|
206
|
-
: (0, markdown_1.createTagPageMD)(item);
|
|
207
|
-
item.markdown = markdown;
|
|
208
202
|
if (item.type === "api") {
|
|
209
203
|
item.json = JSON.stringify(item.api);
|
|
210
204
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
@@ -216,6 +210,12 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
216
210
|
if (item.infoId)
|
|
217
211
|
item.infoPath = infoBasePath;
|
|
218
212
|
}
|
|
213
|
+
const markdown = item.type === "api"
|
|
214
|
+
? (0, markdown_1.createApiPageMD)(item)
|
|
215
|
+
: item.type === "info"
|
|
216
|
+
? (0, markdown_1.createInfoPageMD)(item)
|
|
217
|
+
: (0, markdown_1.createTagPageMD)(item);
|
|
218
|
+
item.markdown = markdown;
|
|
219
219
|
const view = (0, mustache_1.render)(mdTemplate, item);
|
|
220
220
|
const utils = (0, mustache_1.render)(infoMdTemplate, item);
|
|
221
221
|
// eslint-disable-next-line testing-library/render-result-naming-convention
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createAuthorization(infoPath: string): string[] | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.createAuthorization = void 0;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createAuthorization(infoPath) {
|
|
12
|
+
if (!infoPath)
|
|
13
|
+
return undefined;
|
|
14
|
+
return [(0, utils_1.create)("SecuritySchemes", { infoPath: infoPath }), "\n\n"];
|
|
15
|
+
}
|
|
16
|
+
exports.createAuthorization = createAuthorization;
|
package/lib/markdown/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ApiPageMetadata, InfoPageMetadata, TagPageMetadata } from "../types";
|
|
2
|
-
export declare function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, method, path, extensions, parameters, requestBody, responses, }, frontMatter, }: ApiPageMetadata): string;
|
|
2
|
+
export declare function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, method, path, extensions, parameters, requestBody, responses, }, infoPath, frontMatter, }: ApiPageMetadata): string;
|
|
3
3
|
export declare function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService, logo, darkLogo, }, securitySchemes, downloadUrl, }: InfoPageMetadata): string;
|
|
4
4
|
export declare function createTagPageMD({ tag: { description } }: TagPageMetadata): string;
|
package/lib/markdown/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createTagPageMD = exports.createInfoPageMD = exports.createApiPageMD = void 0;
|
|
10
10
|
const createAuthentication_1 = require("./createAuthentication");
|
|
11
|
+
const createAuthorization_1 = require("./createAuthorization");
|
|
11
12
|
const createContactInfo_1 = require("./createContactInfo");
|
|
12
13
|
const createDeprecationNotice_1 = require("./createDeprecationNotice");
|
|
13
14
|
const createDescription_1 = require("./createDescription");
|
|
@@ -23,11 +24,12 @@ const createTermsOfService_1 = require("./createTermsOfService");
|
|
|
23
24
|
const createVendorExtensions_1 = require("./createVendorExtensions");
|
|
24
25
|
const createVersionBadge_1 = require("./createVersionBadge");
|
|
25
26
|
const utils_1 = require("./utils");
|
|
26
|
-
function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, method, path, extensions, parameters, requestBody, responses, }, frontMatter, }) {
|
|
27
|
+
function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, method, path, extensions, parameters, requestBody, responses, }, infoPath, frontMatter, }) {
|
|
27
28
|
return (0, utils_1.render)([
|
|
28
29
|
`import ApiTabs from "@theme/ApiTabs";\n`,
|
|
29
30
|
`import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
|
|
30
31
|
`import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint";\n`,
|
|
32
|
+
`import SecuritySchemes from "@theme/ApiDemoPanel/SecuritySchemes";\n`,
|
|
31
33
|
`import MimeTabs from "@theme/MimeTabs";\n`,
|
|
32
34
|
`import ParamsItem from "@theme/ParamsItem";\n`,
|
|
33
35
|
`import ResponseSamples from "@theme/ResponseSamples";\n`,
|
|
@@ -37,6 +39,7 @@ function createApiPageMD({ title, api: { deprecated, "x-deprecated-description":
|
|
|
37
39
|
(0, createHeading_1.createHeading)(title.replace(utils_1.lessThan, "<").replace(utils_1.greaterThan, ">")),
|
|
38
40
|
(0, createMethodEndpoint_1.createMethodEndpoint)(method, path),
|
|
39
41
|
`## ${title.replace(utils_1.lessThan, "<").replace(utils_1.greaterThan, ">")}\n\n`,
|
|
42
|
+
infoPath && (0, createAuthorization_1.createAuthorization)(infoPath),
|
|
40
43
|
frontMatter.show_extensions && (0, createVendorExtensions_1.createVendorExtensions)(extensions),
|
|
41
44
|
(0, createDeprecationNotice_1.createDeprecationNotice)({ deprecated, description: deprecatedDescription }),
|
|
42
45
|
(0, createDescription_1.createDescription)(description),
|
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-beta.
|
|
4
|
+
"version": "0.0.0-beta.641",
|
|
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": "24122ee7955286109c55455fc3213dd0807aaea4"
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -243,13 +243,6 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
243
243
|
item.downloadUrl = downloadUrl;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
const markdown =
|
|
247
|
-
item.type === "api"
|
|
248
|
-
? createApiPageMD(item)
|
|
249
|
-
: item.type === "info"
|
|
250
|
-
? createInfoPageMD(item)
|
|
251
|
-
: createTagPageMD(item);
|
|
252
|
-
item.markdown = markdown;
|
|
253
246
|
if (item.type === "api") {
|
|
254
247
|
item.json = JSON.stringify(item.api);
|
|
255
248
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
@@ -260,6 +253,13 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
260
253
|
}
|
|
261
254
|
if (item.infoId) item.infoPath = infoBasePath;
|
|
262
255
|
}
|
|
256
|
+
const markdown =
|
|
257
|
+
item.type === "api"
|
|
258
|
+
? createApiPageMD(item)
|
|
259
|
+
: item.type === "info"
|
|
260
|
+
? createInfoPageMD(item)
|
|
261
|
+
: createTagPageMD(item);
|
|
262
|
+
item.markdown = markdown;
|
|
263
263
|
|
|
264
264
|
const view = render(mdTemplate, item);
|
|
265
265
|
const utils = render(infoMdTemplate, item);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { create } from "./utils";
|
|
9
|
+
|
|
10
|
+
export function createAuthorization(infoPath: string) {
|
|
11
|
+
if (!infoPath) return undefined;
|
|
12
|
+
return [create("SecuritySchemes", { infoPath: infoPath }), "\n\n"];
|
|
13
|
+
}
|
package/src/markdown/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../openapi/types";
|
|
14
14
|
import { ApiPageMetadata, InfoPageMetadata, TagPageMetadata } from "../types";
|
|
15
15
|
import { createAuthentication } from "./createAuthentication";
|
|
16
|
+
import { createAuthorization } from "./createAuthorization";
|
|
16
17
|
import { createContactInfo } from "./createContactInfo";
|
|
17
18
|
import { createDeprecationNotice } from "./createDeprecationNotice";
|
|
18
19
|
import { createDescription } from "./createDescription";
|
|
@@ -53,12 +54,14 @@ export function createApiPageMD({
|
|
|
53
54
|
requestBody,
|
|
54
55
|
responses,
|
|
55
56
|
},
|
|
57
|
+
infoPath,
|
|
56
58
|
frontMatter,
|
|
57
59
|
}: ApiPageMetadata) {
|
|
58
60
|
return render([
|
|
59
61
|
`import ApiTabs from "@theme/ApiTabs";\n`,
|
|
60
62
|
`import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
|
|
61
63
|
`import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint";\n`,
|
|
64
|
+
`import SecuritySchemes from "@theme/ApiDemoPanel/SecuritySchemes";\n`,
|
|
62
65
|
`import MimeTabs from "@theme/MimeTabs";\n`,
|
|
63
66
|
`import ParamsItem from "@theme/ParamsItem";\n`,
|
|
64
67
|
`import ResponseSamples from "@theme/ResponseSamples";\n`,
|
|
@@ -68,6 +71,7 @@ export function createApiPageMD({
|
|
|
68
71
|
createHeading(title.replace(lessThan, "<").replace(greaterThan, ">")),
|
|
69
72
|
createMethodEndpoint(method, path),
|
|
70
73
|
`## ${title.replace(lessThan, "<").replace(greaterThan, ">")}\n\n`,
|
|
74
|
+
infoPath && createAuthorization(infoPath),
|
|
71
75
|
frontMatter.show_extensions && createVendorExtensions(extensions),
|
|
72
76
|
createDeprecationNotice({ deprecated, description: deprecatedDescription }),
|
|
73
77
|
createDescription(description),
|