docusaurus-plugin-openapi-docs 0.0.0-1000
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/LICENSE +21 -0
- package/README.md +361 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +709 -0
- package/lib/markdown/createArrayBracket.d.ts +2 -0
- package/lib/markdown/createArrayBracket.js +36 -0
- package/lib/markdown/createAuthentication.d.ts +2 -0
- package/lib/markdown/createAuthentication.js +171 -0
- package/lib/markdown/createAuthorization.d.ts +1 -0
- package/lib/markdown/createAuthorization.js +15 -0
- package/lib/markdown/createCallbackMethodEndpoint.d.ts +1 -0
- package/lib/markdown/createCallbackMethodEndpoint.js +20 -0
- package/lib/markdown/createCallbacks.d.ts +6 -0
- package/lib/markdown/createCallbacks.js +77 -0
- package/lib/markdown/createContactInfo.d.ts +2 -0
- package/lib/markdown/createContactInfo.js +39 -0
- package/lib/markdown/createDeprecationNotice.d.ts +6 -0
- package/lib/markdown/createDeprecationNotice.js +20 -0
- package/lib/markdown/createDescription.d.ts +1 -0
- package/lib/markdown/createDescription.js +13 -0
- package/lib/markdown/createDetails.d.ts +2 -0
- package/lib/markdown/createDetails.js +17 -0
- package/lib/markdown/createDetailsSummary.d.ts +2 -0
- package/lib/markdown/createDetailsSummary.js +17 -0
- package/lib/markdown/createDownload.d.ts +1 -0
- package/lib/markdown/createDownload.js +16 -0
- package/lib/markdown/createHeading.d.ts +1 -0
- package/lib/markdown/createHeading.js +20 -0
- package/lib/markdown/createLicense.d.ts +2 -0
- package/lib/markdown/createLicense.js +32 -0
- package/lib/markdown/createLogo.d.ts +2 -0
- package/lib/markdown/createLogo.js +18 -0
- package/lib/markdown/createMethodEndpoint.d.ts +1 -0
- package/lib/markdown/createMethodEndpoint.js +20 -0
- package/lib/markdown/createParamsDetails.d.ts +6 -0
- package/lib/markdown/createParamsDetails.js +18 -0
- package/lib/markdown/createRequestBodyDetails.d.ts +13 -0
- package/lib/markdown/createRequestBodyDetails.js +13 -0
- package/lib/markdown/createRequestHeader.d.ts +1 -0
- package/lib/markdown/createRequestHeader.js +21 -0
- package/lib/markdown/createRequestSchema.d.ts +14 -0
- package/lib/markdown/createRequestSchema.js +20 -0
- package/lib/markdown/createResponseSchema.d.ts +14 -0
- package/lib/markdown/createResponseSchema.js +20 -0
- package/lib/markdown/createSchema.d.ts +9 -0
- package/lib/markdown/createSchema.js +668 -0
- package/lib/markdown/createSchema.test.d.ts +1 -0
- package/lib/markdown/createSchema.test.js +913 -0
- package/lib/markdown/createStatusCodes.d.ts +9 -0
- package/lib/markdown/createStatusCodes.js +63 -0
- package/lib/markdown/createTermsOfService.d.ts +1 -0
- package/lib/markdown/createTermsOfService.js +31 -0
- package/lib/markdown/createVendorExtensions.d.ts +1 -0
- package/lib/markdown/createVendorExtensions.js +24 -0
- package/lib/markdown/createVersionBadge.d.ts +1 -0
- package/lib/markdown/createVersionBadge.js +19 -0
- package/lib/markdown/index.d.ts +5 -0
- package/lib/markdown/index.js +92 -0
- package/lib/markdown/schema.d.ts +3 -0
- package/lib/markdown/schema.js +154 -0
- package/lib/markdown/schema.test.d.ts +1 -0
- package/lib/markdown/schema.test.js +181 -0
- package/lib/markdown/utils.d.ts +20 -0
- package/lib/markdown/utils.js +68 -0
- package/lib/openapi/createRequestExample.d.ts +2 -0
- package/lib/openapi/createRequestExample.js +191 -0
- package/lib/openapi/createResponseExample.d.ts +2 -0
- package/lib/openapi/createResponseExample.js +192 -0
- package/lib/openapi/index.d.ts +1 -0
- package/lib/openapi/index.js +12 -0
- package/lib/openapi/openapi.d.ts +12 -0
- package/lib/openapi/openapi.js +544 -0
- package/lib/openapi/openapi.test.d.ts +1 -0
- package/lib/openapi/openapi.test.js +33 -0
- package/lib/openapi/types.d.ts +354 -0
- package/lib/openapi/types.js +8 -0
- package/lib/openapi/utils/loadAndResolveSpec.d.ts +2 -0
- package/lib/openapi/utils/loadAndResolveSpec.js +153 -0
- package/lib/openapi/utils/services/OpenAPIParser.d.ts +52 -0
- package/lib/openapi/utils/services/OpenAPIParser.js +343 -0
- package/lib/openapi/utils/services/RedocNormalizedOptions.d.ts +100 -0
- package/lib/openapi/utils/services/RedocNormalizedOptions.js +170 -0
- package/lib/openapi/utils/types/index.d.ts +2 -0
- package/lib/openapi/utils/types/index.js +23 -0
- package/lib/openapi/utils/types/open-api.d.ts +305 -0
- package/lib/openapi/utils/types/open-api.js +8 -0
- package/lib/openapi/utils/types.d.ts +306 -0
- package/lib/openapi/utils/types.js +8 -0
- package/lib/openapi/utils/utils/JsonPointer.d.ts +51 -0
- package/lib/openapi/utils/utils/JsonPointer.js +95 -0
- package/lib/openapi/utils/utils/helpers.d.ts +43 -0
- package/lib/openapi/utils/utils/helpers.js +230 -0
- package/lib/openapi/utils/utils/index.d.ts +3 -0
- package/lib/openapi/utils/utils/index.js +25 -0
- package/lib/openapi/utils/utils/openapi.d.ts +40 -0
- package/lib/openapi/utils/utils/openapi.js +605 -0
- package/lib/options.d.ts +2 -0
- package/lib/options.js +69 -0
- package/lib/sidebars/index.d.ts +4 -0
- package/lib/sidebars/index.js +226 -0
- package/lib/sidebars/utils.d.ts +2 -0
- package/lib/sidebars/utils.js +30 -0
- package/lib/types.d.ts +135 -0
- package/lib/types.js +8 -0
- package/package.json +69 -0
- package/src/index.ts +945 -0
- package/src/markdown/__snapshots__/createSchema.test.ts.snap +1605 -0
- package/src/markdown/createArrayBracket.ts +35 -0
- package/src/markdown/createAuthentication.ts +201 -0
- package/src/markdown/createAuthorization.ts +13 -0
- package/src/markdown/createCallbackMethodEndpoint.ts +19 -0
- package/src/markdown/createCallbacks.ts +101 -0
- package/src/markdown/createContactInfo.ts +41 -0
- package/src/markdown/createDeprecationNotice.ts +31 -0
- package/src/markdown/createDescription.ts +12 -0
- package/src/markdown/createDetails.ts +16 -0
- package/src/markdown/createDetailsSummary.ts +16 -0
- package/src/markdown/createDownload.ts +15 -0
- package/src/markdown/createHeading.ts +23 -0
- package/src/markdown/createLicense.ts +34 -0
- package/src/markdown/createLogo.ts +21 -0
- package/src/markdown/createMethodEndpoint.ts +19 -0
- package/src/markdown/createParamsDetails.ts +22 -0
- package/src/markdown/createRequestBodyDetails.ts +24 -0
- package/src/markdown/createRequestHeader.ts +24 -0
- package/src/markdown/createRequestSchema.ts +32 -0
- package/src/markdown/createResponseSchema.ts +32 -0
- package/src/markdown/createSchema.test.ts +1075 -0
- package/src/markdown/createSchema.ts +862 -0
- package/src/markdown/createStatusCodes.ts +63 -0
- package/src/markdown/createTermsOfService.ts +30 -0
- package/src/markdown/createVendorExtensions.ts +22 -0
- package/src/markdown/createVersionBadge.ts +22 -0
- package/src/markdown/index.ts +144 -0
- package/src/markdown/schema.test.ts +208 -0
- package/src/markdown/schema.ts +185 -0
- package/src/markdown/utils.ts +89 -0
- package/src/openapi/__fixtures__/examples/openapi.yaml +49 -0
- package/src/openapi/createRequestExample.ts +235 -0
- package/src/openapi/createResponseExample.ts +238 -0
- package/src/openapi/index.ts +8 -0
- package/src/openapi/openapi.test.ts +40 -0
- package/src/openapi/openapi.ts +697 -0
- package/src/openapi/types.ts +455 -0
- package/src/openapi/utils/loadAndResolveSpec.ts +171 -0
- package/src/openapi/utils/services/OpenAPIParser.ts +434 -0
- package/src/openapi/utils/services/RedocNormalizedOptions.ts +330 -0
- package/src/openapi/utils/types/index.ts +10 -0
- package/src/openapi/utils/types/open-api.ts +303 -0
- package/src/openapi/utils/types.ts +303 -0
- package/src/openapi/utils/utils/JsonPointer.ts +99 -0
- package/src/openapi/utils/utils/helpers.ts +239 -0
- package/src/openapi/utils/utils/index.ts +11 -0
- package/src/openapi/utils/utils/openapi.ts +771 -0
- package/src/openapi-to-postmanv2.d.ts +10 -0
- package/src/options.ts +77 -0
- package/src/plugin-content-docs-types.d.ts +42 -0
- package/src/plugin-openapi.d.ts +87 -0
- package/src/postman-collection.d.ts +10 -0
- package/src/sidebars/index.ts +322 -0
- package/src/sidebars/utils.ts +29 -0
- package/src/types.ts +176 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,36 @@
|
|
|
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.createOpeningArrayBracket = createOpeningArrayBracket;
|
|
10
|
+
exports.createClosingArrayBracket = createClosingArrayBracket;
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
function createOpeningArrayBracket() {
|
|
13
|
+
return (0, utils_1.create)("li", {
|
|
14
|
+
children: (0, utils_1.create)("div", {
|
|
15
|
+
style: {
|
|
16
|
+
fontSize: "var(--ifm-code-font-size)",
|
|
17
|
+
opacity: "0.6",
|
|
18
|
+
marginLeft: "-.5rem",
|
|
19
|
+
paddingBottom: ".5rem",
|
|
20
|
+
},
|
|
21
|
+
children: ["Array ["],
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function createClosingArrayBracket() {
|
|
26
|
+
return (0, utils_1.create)("li", {
|
|
27
|
+
children: (0, utils_1.create)("div", {
|
|
28
|
+
style: {
|
|
29
|
+
fontSize: "var(--ifm-code-font-size)",
|
|
30
|
+
opacity: "0.6",
|
|
31
|
+
marginLeft: "-.5rem",
|
|
32
|
+
},
|
|
33
|
+
children: ["]"],
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
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.createAuthentication = createAuthentication;
|
|
10
|
+
const createDescription_1 = require("./createDescription");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
function createAuthentication(securitySchemes) {
|
|
13
|
+
if (!securitySchemes || !Object.keys(securitySchemes).length)
|
|
14
|
+
return "";
|
|
15
|
+
const createAuthenticationTable = (securityScheme) => {
|
|
16
|
+
const { bearerFormat, flows, name, scheme, type, openIdConnectUrl } = securityScheme;
|
|
17
|
+
const createSecuritySchemeTypeRow = () => (0, utils_1.create)("tr", {
|
|
18
|
+
children: [
|
|
19
|
+
(0, utils_1.create)("th", { children: "Security Scheme Type:" }),
|
|
20
|
+
(0, utils_1.create)("td", { children: type }),
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
const createOAuthFlowRows = () => {
|
|
24
|
+
const flowRows = Object.entries(flows).map(([flowType, flowObj]) => {
|
|
25
|
+
const { authorizationUrl, tokenUrl, refreshUrl, scopes } = flowObj;
|
|
26
|
+
return (0, utils_1.create)("tr", {
|
|
27
|
+
children: [
|
|
28
|
+
(0, utils_1.create)("th", { children: `OAuth Flow (${flowType}):` }),
|
|
29
|
+
(0, utils_1.create)("td", {
|
|
30
|
+
children: [
|
|
31
|
+
(0, utils_1.guard)(tokenUrl, () => (0, utils_1.create)("div", { children: `Token URL: ${tokenUrl}` })),
|
|
32
|
+
(0, utils_1.guard)(authorizationUrl, () => (0, utils_1.create)("div", {
|
|
33
|
+
children: `Authorization URL: ${authorizationUrl}`,
|
|
34
|
+
})),
|
|
35
|
+
(0, utils_1.guard)(refreshUrl, () => (0, utils_1.create)("div", { children: `Refresh URL: ${refreshUrl}` })),
|
|
36
|
+
(0, utils_1.create)("span", { children: "Scopes:" }),
|
|
37
|
+
(0, utils_1.create)("ul", {
|
|
38
|
+
children: Object.entries(scopes).map(([scope, description]) => (0, utils_1.create)("li", { children: `${scope}: ${description}` })),
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return flowRows.join("");
|
|
46
|
+
};
|
|
47
|
+
switch (type) {
|
|
48
|
+
case "apiKey":
|
|
49
|
+
return (0, utils_1.create)("div", {
|
|
50
|
+
children: [
|
|
51
|
+
(0, utils_1.create)("table", {
|
|
52
|
+
children: (0, utils_1.create)("tbody", {
|
|
53
|
+
children: [
|
|
54
|
+
createSecuritySchemeTypeRow(),
|
|
55
|
+
(0, utils_1.create)("tr", {
|
|
56
|
+
children: [
|
|
57
|
+
(0, utils_1.create)("th", { children: "Header parameter name:" }),
|
|
58
|
+
(0, utils_1.create)("td", { children: name }),
|
|
59
|
+
],
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
62
|
+
}),
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
case "http":
|
|
67
|
+
return (0, utils_1.create)("div", {
|
|
68
|
+
children: [
|
|
69
|
+
(0, utils_1.create)("table", {
|
|
70
|
+
children: (0, utils_1.create)("tbody", {
|
|
71
|
+
children: [
|
|
72
|
+
createSecuritySchemeTypeRow(),
|
|
73
|
+
(0, utils_1.create)("tr", {
|
|
74
|
+
children: [
|
|
75
|
+
(0, utils_1.create)("th", { children: "HTTP Authorization Scheme:" }),
|
|
76
|
+
(0, utils_1.create)("td", { children: scheme }),
|
|
77
|
+
],
|
|
78
|
+
}),
|
|
79
|
+
(0, utils_1.guard)(bearerFormat, () => (0, utils_1.create)("tr", {
|
|
80
|
+
children: [
|
|
81
|
+
(0, utils_1.create)("th", { children: "Bearer format:" }),
|
|
82
|
+
(0, utils_1.create)("td", { children: bearerFormat }),
|
|
83
|
+
],
|
|
84
|
+
})),
|
|
85
|
+
],
|
|
86
|
+
}),
|
|
87
|
+
}),
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
case "oauth2":
|
|
91
|
+
return (0, utils_1.create)("div", {
|
|
92
|
+
children: [
|
|
93
|
+
(0, utils_1.create)("table", {
|
|
94
|
+
children: (0, utils_1.create)("tbody", {
|
|
95
|
+
children: [
|
|
96
|
+
createSecuritySchemeTypeRow(),
|
|
97
|
+
createOAuthFlowRows(),
|
|
98
|
+
],
|
|
99
|
+
}),
|
|
100
|
+
}),
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
case "openIdConnect":
|
|
104
|
+
return (0, utils_1.create)("div", {
|
|
105
|
+
children: [
|
|
106
|
+
(0, utils_1.create)("table", {
|
|
107
|
+
children: (0, utils_1.create)("tbody", {
|
|
108
|
+
children: [
|
|
109
|
+
createSecuritySchemeTypeRow(),
|
|
110
|
+
(0, utils_1.guard)(openIdConnectUrl, () => (0, utils_1.create)("tr", {
|
|
111
|
+
children: [
|
|
112
|
+
(0, utils_1.create)("th", { children: "OpenID Connect URL:" }),
|
|
113
|
+
(0, utils_1.create)("td", { children: openIdConnectUrl }),
|
|
114
|
+
],
|
|
115
|
+
})),
|
|
116
|
+
],
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
default:
|
|
122
|
+
return "";
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const formatTabLabel = (key, type, scheme) => {
|
|
126
|
+
const formattedLabel = key
|
|
127
|
+
.replace(/(_|-)/g, " ")
|
|
128
|
+
.trim()
|
|
129
|
+
.replace(/\w\S*/g, (str) => str.charAt(0).toUpperCase() + str.substr(1))
|
|
130
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
131
|
+
.replace(/([A-Z])([A-Z][a-z])/g, "$1 $2");
|
|
132
|
+
const isOAuth = type === "oauth2";
|
|
133
|
+
const isApiKey = type === "apiKey";
|
|
134
|
+
const isHttpBasic = type === "http" && scheme === "basic";
|
|
135
|
+
const isHttpBearer = type === "http" && scheme === "bearer";
|
|
136
|
+
const isOpenId = type === "openIdConnect";
|
|
137
|
+
if (isOAuth)
|
|
138
|
+
return `OAuth 2.0: ${key}`;
|
|
139
|
+
if (isApiKey)
|
|
140
|
+
return `API Key: ${key}`;
|
|
141
|
+
if (isHttpBasic)
|
|
142
|
+
return "HTTP: Basic Auth";
|
|
143
|
+
if (isHttpBearer)
|
|
144
|
+
return "HTTP: Bearer Auth";
|
|
145
|
+
if (isOpenId)
|
|
146
|
+
return `OpenID Connect: ${key}`;
|
|
147
|
+
return formattedLabel;
|
|
148
|
+
};
|
|
149
|
+
return (0, utils_1.create)("div", {
|
|
150
|
+
children: [
|
|
151
|
+
(0, utils_1.create)("Heading", {
|
|
152
|
+
children: "Authentication",
|
|
153
|
+
id: "authentication",
|
|
154
|
+
as: "h2",
|
|
155
|
+
className: "openapi-tabs__heading",
|
|
156
|
+
}, { inline: true }),
|
|
157
|
+
(0, utils_1.create)("SchemaTabs", {
|
|
158
|
+
className: "openapi-tabs__security-schemes",
|
|
159
|
+
children: Object.entries(securitySchemes).map(([schemeKey, schemeObj]) => (0, utils_1.create)("TabItem", {
|
|
160
|
+
label: formatTabLabel(schemeKey, schemeObj.type, schemeObj.scheme),
|
|
161
|
+
value: `${schemeKey}`,
|
|
162
|
+
children: [
|
|
163
|
+
(0, createDescription_1.createDescription)(schemeObj.description),
|
|
164
|
+
createAuthenticationTable(schemeObj),
|
|
165
|
+
],
|
|
166
|
+
})),
|
|
167
|
+
}),
|
|
168
|
+
],
|
|
169
|
+
style: { marginBottom: "2rem" },
|
|
170
|
+
});
|
|
171
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createAuthorization(infoPath: string): string[] | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 = createAuthorization;
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createCallbackMethodEndpoint(method: String, path: String): string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
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.createCallbackMethodEndpoint = createCallbackMethodEndpoint;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createCallbackMethodEndpoint(method, path) {
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("MethodEndpoint", {
|
|
14
|
+
method: method,
|
|
15
|
+
path: path,
|
|
16
|
+
context: "callback",
|
|
17
|
+
}),
|
|
18
|
+
"\n\n",
|
|
19
|
+
];
|
|
20
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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.createCallbacks = createCallbacks;
|
|
10
|
+
const createCallbackMethodEndpoint_1 = require("./createCallbackMethodEndpoint");
|
|
11
|
+
const createDescription_1 = require("./createDescription");
|
|
12
|
+
const createRequestBodyDetails_1 = require("./createRequestBodyDetails");
|
|
13
|
+
const createStatusCodes_1 = require("./createStatusCodes");
|
|
14
|
+
const utils_1 = require("./utils");
|
|
15
|
+
function createCallbacks({ callbacks }) {
|
|
16
|
+
if (callbacks === undefined) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const callbacksNames = Object.keys(callbacks);
|
|
20
|
+
if (callbacksNames.length === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return (0, utils_1.create)("div", {
|
|
24
|
+
children: [
|
|
25
|
+
(0, utils_1.create)("div", {
|
|
26
|
+
className: "openapi__divider",
|
|
27
|
+
}),
|
|
28
|
+
(0, utils_1.create)("Heading", {
|
|
29
|
+
children: "Callbacks",
|
|
30
|
+
id: "callbacks",
|
|
31
|
+
as: "h2",
|
|
32
|
+
className: "openapi-tabs__heading",
|
|
33
|
+
}, { inline: true }),
|
|
34
|
+
(0, utils_1.create)("OperationTabs", {
|
|
35
|
+
className: "openapi-tabs__operation",
|
|
36
|
+
children: callbacksNames.flatMap((name) => {
|
|
37
|
+
const path = Object.keys(callbacks[name])[0];
|
|
38
|
+
const methods = new Map([
|
|
39
|
+
["delete", callbacks[name][path].delete],
|
|
40
|
+
["get", callbacks[name][path].get],
|
|
41
|
+
["head", callbacks[name][path].head],
|
|
42
|
+
["options", callbacks[name][path].options],
|
|
43
|
+
["patch", callbacks[name][path].patch],
|
|
44
|
+
["post", callbacks[name][path].post],
|
|
45
|
+
["put", callbacks[name][path].put],
|
|
46
|
+
["trace", callbacks[name][path].trace],
|
|
47
|
+
]);
|
|
48
|
+
return Array.from(methods).flatMap(([method, operationObject]) => {
|
|
49
|
+
if (!operationObject)
|
|
50
|
+
return [];
|
|
51
|
+
const { description, requestBody, responses } = operationObject;
|
|
52
|
+
return [
|
|
53
|
+
(0, utils_1.create)("TabItem", {
|
|
54
|
+
label: `${method.toUpperCase()} ${name}`,
|
|
55
|
+
value: `${method}-${name}`,
|
|
56
|
+
children: [
|
|
57
|
+
(0, createCallbackMethodEndpoint_1.createCallbackMethodEndpoint)(method, path),
|
|
58
|
+
// TODO: add `deprecation notice` when markdown support is added
|
|
59
|
+
(0, createDescription_1.createDescription)(description),
|
|
60
|
+
(0, createRequestBodyDetails_1.createRequestBodyDetails)({
|
|
61
|
+
title: "Body",
|
|
62
|
+
body: requestBody,
|
|
63
|
+
}),
|
|
64
|
+
(0, createStatusCodes_1.createStatusCodes)({
|
|
65
|
+
id: "callbacks-responses",
|
|
66
|
+
label: "Callbacks Responses",
|
|
67
|
+
responses,
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
}),
|
|
71
|
+
];
|
|
72
|
+
});
|
|
73
|
+
}),
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.createContactInfo = createContactInfo;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createContactInfo(contact) {
|
|
12
|
+
if (!contact || !Object.keys(contact).length)
|
|
13
|
+
return "";
|
|
14
|
+
const { name, url, email } = contact;
|
|
15
|
+
return (0, utils_1.create)("div", {
|
|
16
|
+
style: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
marginBottom: "var(--ifm-paragraph-margin-bottom)",
|
|
20
|
+
},
|
|
21
|
+
children: [
|
|
22
|
+
(0, utils_1.create)("h3", {
|
|
23
|
+
style: {
|
|
24
|
+
marginBottom: "0.25rem",
|
|
25
|
+
},
|
|
26
|
+
children: "Contact",
|
|
27
|
+
}),
|
|
28
|
+
(0, utils_1.create)("span", {
|
|
29
|
+
children: [
|
|
30
|
+
(0, utils_1.guard)(name, () => `${name}: `),
|
|
31
|
+
(0, utils_1.guard)(email, () => `[${email}](mailto:${email})`),
|
|
32
|
+
],
|
|
33
|
+
}),
|
|
34
|
+
(0, utils_1.guard)(url, () => (0, utils_1.create)("span", {
|
|
35
|
+
children: ["URL: ", `[${url}](${url})`],
|
|
36
|
+
})),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.createDeprecationNotice = createDeprecationNotice;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createAdmonition({ children }) {
|
|
12
|
+
return `:::caution deprecated\n\n${(0, utils_1.render)(children)}\n\n:::`;
|
|
13
|
+
}
|
|
14
|
+
function createDeprecationNotice({ deprecated, description, }) {
|
|
15
|
+
return (0, utils_1.guard)(deprecated, () => createAdmonition({
|
|
16
|
+
children: description && description.length > 0
|
|
17
|
+
? (0, utils_1.clean)(description)
|
|
18
|
+
: "This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createDescription(description: string | undefined): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.createDescription = createDescription;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createDescription(description) {
|
|
12
|
+
return `\n\n${(0, utils_1.clean)(description)}\n\n`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.createDetails = createDetails;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createDetails({ children, style, ...rest }) {
|
|
12
|
+
return (0, utils_1.create)("details", {
|
|
13
|
+
style: { ...style },
|
|
14
|
+
...rest,
|
|
15
|
+
children,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.createDetailsSummary = createDetailsSummary;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createDetailsSummary({ children, style, ...rest }) {
|
|
12
|
+
return (0, utils_1.create)("summary", {
|
|
13
|
+
style: { ...style },
|
|
14
|
+
...rest,
|
|
15
|
+
children,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createDownload(url: string | undefined): string;
|
|
@@ -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.createDownload = createDownload;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createDownload(url) {
|
|
12
|
+
return (0, utils_1.guard)(url, (url) => [
|
|
13
|
+
(0, utils_1.create)("Export", { url: url, proxy: undefined }),
|
|
14
|
+
`\n\n`,
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createHeading(heading: string): string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
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.createHeading = createHeading;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createHeading(heading) {
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("Heading", {
|
|
14
|
+
children: (0, utils_1.clean)(heading),
|
|
15
|
+
as: "h1",
|
|
16
|
+
className: "openapi__heading",
|
|
17
|
+
}, { inline: true }),
|
|
18
|
+
`\n\n`,
|
|
19
|
+
];
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.createLicense = createLicense;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createLicense(license) {
|
|
12
|
+
if (!license || !Object.keys(license).length)
|
|
13
|
+
return "";
|
|
14
|
+
const { name, url } = license;
|
|
15
|
+
return (0, utils_1.create)("div", {
|
|
16
|
+
style: {
|
|
17
|
+
marginBottom: "var(--ifm-paragraph-margin-bottom)",
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
(0, utils_1.create)("h3", {
|
|
21
|
+
style: {
|
|
22
|
+
marginBottom: "0.25rem",
|
|
23
|
+
},
|
|
24
|
+
children: "License",
|
|
25
|
+
}),
|
|
26
|
+
(0, utils_1.guard)(url, () => (0, utils_1.create)("a", {
|
|
27
|
+
href: url,
|
|
28
|
+
children: name !== null && name !== void 0 ? name : url,
|
|
29
|
+
})),
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 = createLogo;
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createMethodEndpoint(method: String, path: String): string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
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.createMethodEndpoint = createMethodEndpoint;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createMethodEndpoint(method, path) {
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("MethodEndpoint", {
|
|
14
|
+
method: method,
|
|
15
|
+
path: path,
|
|
16
|
+
context: "endpoint",
|
|
17
|
+
}),
|
|
18
|
+
"\n\n",
|
|
19
|
+
];
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.createParamsDetails = createParamsDetails;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createParamsDetails({ parameters }) {
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("ParamsDetails", {
|
|
14
|
+
parameters: parameters,
|
|
15
|
+
}),
|
|
16
|
+
"\n\n",
|
|
17
|
+
];
|
|
18
|
+
}
|