docusaurus-plugin-openapi-docs 0.0.0-410 → 0.0.0-411
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/markdown/createLogo.d.ts +2 -0
- package/lib/markdown/createLogo.js +19 -0
- package/lib/markdown/index.d.ts +1 -1
- package/lib/markdown/index.js +4 -1
- package/lib/openapi/openapi.js +2 -0
- package/lib/openapi/types.d.ts +7 -0
- package/package.json +2 -2
- package/src/markdown/createLogo.ts +21 -0
- package/src/markdown/index.ts +14 -1
- package/src/openapi/openapi.ts +2 -0
- package/src/openapi/types.ts +8 -0
|
@@ -0,0 +1,19 @@
|
|
|
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.createLogo = void 0;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createLogo(logo, darkLogo) {
|
|
12
|
+
return (0, utils_1.guard)(logo || darkLogo, () => [
|
|
13
|
+
(0, utils_1.create)("ApiLogo", {
|
|
14
|
+
logo: logo,
|
|
15
|
+
darkLogo: darkLogo,
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
exports.createLogo = createLogo;
|
package/lib/markdown/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ApiPageMetadata, InfoPageMetadata, TagPageMetadata } from "../types";
|
|
2
2
|
export declare function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, parameters, requestBody, responses, }, }: ApiPageMetadata): string;
|
|
3
|
-
export declare function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService }, securitySchemes, }: InfoPageMetadata): string;
|
|
3
|
+
export declare function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService, logo, darkLogo, }, securitySchemes, }: InfoPageMetadata): string;
|
|
4
4
|
export declare function createTagPageMD({ tag: { description } }: TagPageMetadata): string;
|
package/lib/markdown/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const createContactInfo_1 = require("./createContactInfo");
|
|
|
13
13
|
const createDeprecationNotice_1 = require("./createDeprecationNotice");
|
|
14
14
|
const createDescription_1 = require("./createDescription");
|
|
15
15
|
const createLicense_1 = require("./createLicense");
|
|
16
|
+
const createLogo_1 = require("./createLogo");
|
|
16
17
|
const createParamsDetails_1 = require("./createParamsDetails");
|
|
17
18
|
const createRequestBodyDetails_1 = require("./createRequestBodyDetails");
|
|
18
19
|
const createStatusCodes_1 = require("./createStatusCodes");
|
|
@@ -39,12 +40,14 @@ function createApiPageMD({ title, api: { deprecated, "x-deprecated-description":
|
|
|
39
40
|
]);
|
|
40
41
|
}
|
|
41
42
|
exports.createApiPageMD = createApiPageMD;
|
|
42
|
-
function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService }, securitySchemes, }) {
|
|
43
|
+
function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService, logo, darkLogo, }, securitySchemes, }) {
|
|
43
44
|
return (0, utils_1.render)([
|
|
45
|
+
`import ApiLogo from "@theme/ApiLogo";\n`,
|
|
44
46
|
`import Tabs from "@theme/Tabs";\n`,
|
|
45
47
|
`import TabItem from "@theme/TabItem";\n\n`,
|
|
46
48
|
(0, createVersionBadge_1.createVersionBadge)(version),
|
|
47
49
|
`# ${(0, lodash_1.escape)(title)}\n\n`,
|
|
50
|
+
(0, createLogo_1.createLogo)(logo, darkLogo),
|
|
48
51
|
(0, createDescription_1.createDescription)(description),
|
|
49
52
|
(0, createAuthentication_1.createAuthentication)(securitySchemes),
|
|
50
53
|
(0, createContactInfo_1.createContactInfo)(contact),
|
package/lib/openapi/openapi.js
CHANGED
|
@@ -102,6 +102,8 @@ function createItems(openapiData, sidebarOptions) {
|
|
|
102
102
|
...openapiData.info,
|
|
103
103
|
tags: (_c = openapiData.tags) === null || _c === void 0 ? void 0 : _c.map((tagName) => { var _a; return getTagDisplayName(tagName.name, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []); }),
|
|
104
104
|
title: (_d = openapiData.info.title) !== null && _d !== void 0 ? _d : "Introduction",
|
|
105
|
+
logo: openapiData.info["x-logo"],
|
|
106
|
+
darkLogo: openapiData.info["x-dark-logo"],
|
|
105
107
|
},
|
|
106
108
|
};
|
|
107
109
|
items.push(infoPage);
|
package/lib/openapi/types.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ export interface InfoObject {
|
|
|
31
31
|
license?: LicenseObject;
|
|
32
32
|
version: string;
|
|
33
33
|
tags?: String[];
|
|
34
|
+
"x-logo"?: LogoObject;
|
|
35
|
+
"x-dark-logo"?: LogoObject;
|
|
36
|
+
logo?: LogoObject;
|
|
37
|
+
darkLogo?: LogoObject;
|
|
38
|
+
}
|
|
39
|
+
export interface LogoObject {
|
|
40
|
+
url?: string;
|
|
34
41
|
}
|
|
35
42
|
export interface ContactObject {
|
|
36
43
|
name?: string;
|
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-411",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=14"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "f3967eda19d631760dc9e7f9e5a358897964f0a7"
|
|
71
71
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { LogoObject } from "../openapi/types";
|
|
9
|
+
import { create, guard } from "./utils";
|
|
10
|
+
|
|
11
|
+
export function createLogo(
|
|
12
|
+
logo: LogoObject | undefined,
|
|
13
|
+
darkLogo: LogoObject | undefined
|
|
14
|
+
) {
|
|
15
|
+
return guard(logo || darkLogo, () => [
|
|
16
|
+
create("ApiLogo", {
|
|
17
|
+
logo: logo,
|
|
18
|
+
darkLogo: darkLogo,
|
|
19
|
+
}),
|
|
20
|
+
]);
|
|
21
|
+
}
|
package/src/markdown/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { createContactInfo } from "./createContactInfo";
|
|
|
18
18
|
import { createDeprecationNotice } from "./createDeprecationNotice";
|
|
19
19
|
import { createDescription } from "./createDescription";
|
|
20
20
|
import { createLicense } from "./createLicense";
|
|
21
|
+
import { createLogo } from "./createLogo";
|
|
21
22
|
import { createParamsDetails } from "./createParamsDetails";
|
|
22
23
|
import { createRequestBodyDetails } from "./createRequestBodyDetails";
|
|
23
24
|
import { createStatusCodes } from "./createStatusCodes";
|
|
@@ -56,14 +57,26 @@ export function createApiPageMD({
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export function createInfoPageMD({
|
|
59
|
-
info: {
|
|
60
|
+
info: {
|
|
61
|
+
title,
|
|
62
|
+
version,
|
|
63
|
+
description,
|
|
64
|
+
contact,
|
|
65
|
+
license,
|
|
66
|
+
termsOfService,
|
|
67
|
+
logo,
|
|
68
|
+
darkLogo,
|
|
69
|
+
},
|
|
60
70
|
securitySchemes,
|
|
61
71
|
}: InfoPageMetadata) {
|
|
62
72
|
return render([
|
|
73
|
+
`import ApiLogo from "@theme/ApiLogo";\n`,
|
|
63
74
|
`import Tabs from "@theme/Tabs";\n`,
|
|
64
75
|
`import TabItem from "@theme/TabItem";\n\n`,
|
|
76
|
+
|
|
65
77
|
createVersionBadge(version),
|
|
66
78
|
`# ${escape(title)}\n\n`,
|
|
79
|
+
createLogo(logo, darkLogo),
|
|
67
80
|
createDescription(description),
|
|
68
81
|
createAuthentication(securitySchemes as unknown as SecuritySchemeObject),
|
|
69
82
|
createContactInfo(contact as ContactObject),
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -128,6 +128,8 @@ function createItems(
|
|
|
128
128
|
getTagDisplayName(tagName.name!, openapiData.tags ?? [])
|
|
129
129
|
),
|
|
130
130
|
title: openapiData.info.title ?? "Introduction",
|
|
131
|
+
logo: openapiData.info["x-logo"]! as any,
|
|
132
|
+
darkLogo: openapiData.info["x-dark-logo"]! as any,
|
|
131
133
|
},
|
|
132
134
|
};
|
|
133
135
|
items.push(infoPage);
|
package/src/openapi/types.ts
CHANGED
|
@@ -42,6 +42,14 @@ export interface InfoObject {
|
|
|
42
42
|
license?: LicenseObject;
|
|
43
43
|
version: string;
|
|
44
44
|
tags?: String[];
|
|
45
|
+
"x-logo"?: LogoObject;
|
|
46
|
+
"x-dark-logo"?: LogoObject;
|
|
47
|
+
logo?: LogoObject;
|
|
48
|
+
darkLogo?: LogoObject;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface LogoObject {
|
|
52
|
+
url?: string;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export interface ContactObject {
|