docusaurus-theme-openapi-docs 4.2.0 → 4.3.1
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/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +0 -12
- package/lib/theme/ApiExplorer/Authorization/index.js +3 -0
- package/lib/theme/ApiExplorer/Body/index.js +11 -2
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +41 -45
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +1 -1
- package/lib/theme/Markdown/Details/_Details.scss +5 -2
- package/lib/theme/Markdown/index.js +160 -18
- package/lib/theme/ParamsItem/index.js +7 -48
- package/lib/theme/RequestSchema/index.js +11 -3
- package/lib/theme/ResponseExamples/index.d.ts +9 -39
- package/lib/theme/ResponseExamples/index.js +3 -99
- package/lib/theme/ResponseHeaders/index.d.ts +13 -0
- package/lib/theme/ResponseHeaders/index.js +39 -0
- package/lib/theme/ResponseSchema/index.js +4 -2
- package/lib/theme/Schema/index.js +29 -21
- package/lib/theme/SchemaItem/index.js +7 -41
- package/lib/theme/StatusCodes/index.js +10 -7
- package/package.json +10 -6
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +0 -12
- package/src/theme/ApiExplorer/Authorization/index.tsx +3 -0
- package/src/theme/ApiExplorer/Body/index.tsx +3 -2
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +45 -47
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +1 -1
- package/src/theme/Markdown/Details/_Details.scss +5 -2
- package/src/theme/Markdown/index.js +160 -18
- package/src/theme/ParamsItem/index.tsx +6 -36
- package/src/theme/RequestSchema/index.tsx +3 -3
- package/src/theme/ResponseExamples/index.tsx +24 -122
- package/src/theme/ResponseHeaders/index.tsx +49 -0
- package/src/theme/ResponseSchema/index.tsx +2 -2
- package/src/theme/Schema/index.tsx +29 -22
- package/src/theme/SchemaItem/index.tsx +11 -35
- package/src/theme/StatusCodes/index.tsx +3 -3
|
@@ -8,13 +8,6 @@ the background in custom CSS file due bug https://github.com/facebook/docusaurus
|
|
|
8
8
|
--docusaurus-highlighted-code-line-bg: rgb(100 100 100);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.theme-code-block-highlighted-line {
|
|
12
|
-
background-color: var(--docusaurus-highlighted-code-line-bg);
|
|
13
|
-
display: block;
|
|
14
|
-
margin: 0 calc(-1 * var(--ifm-pre-padding));
|
|
15
|
-
padding: 0 var(--ifm-pre-padding);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
.openapi-explorer__code-block-code-line {
|
|
19
12
|
display: table-row;
|
|
20
13
|
counter-increment: line-count;
|
|
@@ -36,11 +29,6 @@ the background in custom CSS file due bug https://github.com/facebook/docusaurus
|
|
|
36
29
|
opacity: 0.4;
|
|
37
30
|
}
|
|
38
31
|
|
|
39
|
-
:global(.theme-code-block-highlighted-line)
|
|
40
|
-
.openapi-explorer__code-block-code-line-number::before {
|
|
41
|
-
opacity: 0.8;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
32
|
.openapi-explorer__code-block-code-line-number {
|
|
45
33
|
padding-right: var(--ifm-pre-padding);
|
|
46
34
|
}
|
|
@@ -53,6 +53,7 @@ function Authorization() {
|
|
|
53
53
|
{ label: "Bearer Token", key: a.key + "-bearer" },
|
|
54
54
|
react_1.default.createElement(FormTextInput_1.default, {
|
|
55
55
|
placeholder: "Bearer Token",
|
|
56
|
+
password: true,
|
|
56
57
|
value: data[a.key].token ?? "",
|
|
57
58
|
onChange: (e) => {
|
|
58
59
|
const value = e.target.value;
|
|
@@ -73,6 +74,7 @@ function Authorization() {
|
|
|
73
74
|
{ label: "Bearer Token", key: a.key + "-oauth2" },
|
|
74
75
|
react_1.default.createElement(FormTextInput_1.default, {
|
|
75
76
|
placeholder: "Bearer Token",
|
|
77
|
+
password: true,
|
|
76
78
|
value: data[a.key].token ?? "",
|
|
77
79
|
onChange: (e) => {
|
|
78
80
|
const value = e.target.value;
|
|
@@ -136,6 +138,7 @@ function Authorization() {
|
|
|
136
138
|
{ label: `${a.key}`, key: a.key + "-apikey" },
|
|
137
139
|
react_1.default.createElement(FormTextInput_1.default, {
|
|
138
140
|
placeholder: `${a.key}`,
|
|
141
|
+
password: true,
|
|
139
142
|
value: data[a.key].apiKey ?? "",
|
|
140
143
|
onChange: (e) => {
|
|
141
144
|
const value = e.target.value;
|
|
@@ -23,6 +23,7 @@ const FormTextInput_1 = __importDefault(
|
|
|
23
23
|
);
|
|
24
24
|
const LiveEditor_1 = __importDefault(require("@theme/ApiExplorer/LiveEditor"));
|
|
25
25
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
26
|
+
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
26
27
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
27
28
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
28
29
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
@@ -297,7 +298,11 @@ function Body({
|
|
|
297
298
|
TabItem_1.default,
|
|
298
299
|
{ label: "Example", value: "example" },
|
|
299
300
|
example.summary &&
|
|
300
|
-
react_1.default.createElement(
|
|
301
|
+
react_1.default.createElement(
|
|
302
|
+
Markdown_1.default,
|
|
303
|
+
null,
|
|
304
|
+
example.summary
|
|
305
|
+
),
|
|
301
306
|
exampleBody &&
|
|
302
307
|
react_1.default.createElement(
|
|
303
308
|
LiveEditor_1.default,
|
|
@@ -339,7 +344,11 @@ function Body({
|
|
|
339
344
|
key: example.label,
|
|
340
345
|
},
|
|
341
346
|
example.summary &&
|
|
342
|
-
react_1.default.createElement(
|
|
347
|
+
react_1.default.createElement(
|
|
348
|
+
Markdown_1.default,
|
|
349
|
+
null,
|
|
350
|
+
example.summary
|
|
351
|
+
),
|
|
343
352
|
example.body &&
|
|
344
353
|
react_1.default.createElement(
|
|
345
354
|
LiveEditor_1.default,
|
|
@@ -56,12 +56,6 @@ var __importDefault =
|
|
|
56
56
|
};
|
|
57
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
58
|
exports.languageSet = void 0;
|
|
59
|
-
/* ============================================================================
|
|
60
|
-
* Copyright (c) Palo Alto Networks
|
|
61
|
-
*
|
|
62
|
-
* This source code is licensed under the MIT license found in the
|
|
63
|
-
* LICENSE file in the root directory of this source tree.
|
|
64
|
-
* ========================================================================== */
|
|
65
59
|
const react_1 = __importStar(require("react"));
|
|
66
60
|
const useDocusaurusContext_1 = __importDefault(
|
|
67
61
|
require("@docusaurus/useDocusaurusContext")
|
|
@@ -74,6 +68,7 @@ const buildPostmanRequest_1 = __importDefault(
|
|
|
74
68
|
);
|
|
75
69
|
const CodeTabs_1 = __importDefault(require("@theme/ApiExplorer/CodeTabs"));
|
|
76
70
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
71
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
77
72
|
const postman_code_generators_1 = __importDefault(
|
|
78
73
|
require("postman-code-generators")
|
|
79
74
|
);
|
|
@@ -107,6 +102,40 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
107
102
|
(state) => state.params.header
|
|
108
103
|
);
|
|
109
104
|
const auth = (0, hooks_1.useTypedSelector)((state) => state.auth);
|
|
105
|
+
const clonedAuth = (0, cloneDeep_1.default)(auth);
|
|
106
|
+
let placeholder;
|
|
107
|
+
function cleanCredentials(obj) {
|
|
108
|
+
for (const key in obj) {
|
|
109
|
+
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
110
|
+
// use name as placeholder if exists
|
|
111
|
+
const comboAuthId = Object.keys(obj).join(" and ");
|
|
112
|
+
const authOptions =
|
|
113
|
+
clonedAuth?.options?.[key] ?? clonedAuth?.options?.[comboAuthId];
|
|
114
|
+
placeholder = authOptions?.[0]?.name;
|
|
115
|
+
obj[key] = cleanCredentials(obj[key]);
|
|
116
|
+
} else {
|
|
117
|
+
obj[key] = `<${placeholder ?? key}>`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return obj;
|
|
121
|
+
}
|
|
122
|
+
// scrub credentials from code snippets
|
|
123
|
+
const cleanedAuth = {
|
|
124
|
+
...clonedAuth,
|
|
125
|
+
data: cleanCredentials(clonedAuth.data),
|
|
126
|
+
};
|
|
127
|
+
// Create a Postman request object using cleanedAuth
|
|
128
|
+
const cleanedPostmanRequest = (0, buildPostmanRequest_1.default)(postman, {
|
|
129
|
+
queryParams,
|
|
130
|
+
pathParams,
|
|
131
|
+
cookieParams,
|
|
132
|
+
contentType,
|
|
133
|
+
accept,
|
|
134
|
+
headerParams,
|
|
135
|
+
body,
|
|
136
|
+
server,
|
|
137
|
+
auth: cleanedAuth,
|
|
138
|
+
});
|
|
110
139
|
// User-defined languages array
|
|
111
140
|
// Can override languageSet, change order of langs, override options and variants
|
|
112
141
|
const userDefinedLanguageSet =
|
|
@@ -151,21 +180,10 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
151
180
|
);
|
|
152
181
|
}
|
|
153
182
|
if (language && !!language.options) {
|
|
154
|
-
const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
|
|
155
|
-
queryParams,
|
|
156
|
-
pathParams,
|
|
157
|
-
cookieParams,
|
|
158
|
-
contentType,
|
|
159
|
-
accept,
|
|
160
|
-
headerParams,
|
|
161
|
-
body,
|
|
162
|
-
server,
|
|
163
|
-
auth,
|
|
164
|
-
});
|
|
165
183
|
postman_code_generators_1.default.convert(
|
|
166
184
|
language.language,
|
|
167
185
|
language.variant,
|
|
168
|
-
|
|
186
|
+
cleanedPostmanRequest,
|
|
169
187
|
language.options,
|
|
170
188
|
(error, snippet) => {
|
|
171
189
|
if (error) {
|
|
@@ -182,21 +200,10 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
182
200
|
// This allows users to define only the minimal properties necessary in languageTabs
|
|
183
201
|
// User-defined properties should override languageSet properties
|
|
184
202
|
const mergedLanguage = { ...langSource[0], ...language };
|
|
185
|
-
const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
|
|
186
|
-
queryParams,
|
|
187
|
-
pathParams,
|
|
188
|
-
cookieParams,
|
|
189
|
-
contentType,
|
|
190
|
-
accept,
|
|
191
|
-
headerParams,
|
|
192
|
-
body,
|
|
193
|
-
server,
|
|
194
|
-
auth,
|
|
195
|
-
});
|
|
196
203
|
postman_code_generators_1.default.convert(
|
|
197
204
|
mergedLanguage.language,
|
|
198
205
|
mergedLanguage.variant,
|
|
199
|
-
|
|
206
|
+
cleanedPostmanRequest,
|
|
200
207
|
mergedLanguage.options,
|
|
201
208
|
(error, snippet) => {
|
|
202
209
|
if (error) {
|
|
@@ -219,27 +226,16 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
219
226
|
postman,
|
|
220
227
|
queryParams,
|
|
221
228
|
server,
|
|
222
|
-
|
|
229
|
+
cleanedPostmanRequest,
|
|
223
230
|
mergedLangs,
|
|
224
231
|
]);
|
|
225
|
-
// no dependencies was
|
|
232
|
+
// no dependencies was intentionally set for this particular hook. it's safe as long as if conditions are set
|
|
226
233
|
(0, react_1.useEffect)(function onSelectedVariantUpdate() {
|
|
227
234
|
if (selectedVariant && selectedVariant !== language?.variant) {
|
|
228
|
-
const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
|
|
229
|
-
queryParams,
|
|
230
|
-
pathParams,
|
|
231
|
-
cookieParams,
|
|
232
|
-
contentType,
|
|
233
|
-
accept,
|
|
234
|
-
headerParams,
|
|
235
|
-
body,
|
|
236
|
-
server,
|
|
237
|
-
auth,
|
|
238
|
-
});
|
|
239
235
|
postman_code_generators_1.default.convert(
|
|
240
236
|
language.language,
|
|
241
237
|
selectedVariant,
|
|
242
|
-
|
|
238
|
+
cleanedPostmanRequest,
|
|
243
239
|
language.options,
|
|
244
240
|
(error, snippet) => {
|
|
245
241
|
if (error) {
|
|
@@ -250,7 +246,7 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
250
246
|
);
|
|
251
247
|
}
|
|
252
248
|
});
|
|
253
|
-
// no dependencies was
|
|
249
|
+
// no dependencies was intentionally set for this particular hook. it's safe as long as if conditions are set
|
|
254
250
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
255
251
|
(0, react_1.useEffect)(function onSelectedSampleUpdate() {
|
|
256
252
|
if (
|
|
@@ -23,10 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
/* Top-Level Details Caret Styling */
|
|
25
25
|
.openapi-left-panel__container > .openapi-markdown__details > summary::before,
|
|
26
|
-
.openapi-markdown__details.mime > summary::before
|
|
27
|
-
.openapi-markdown__details.response > summary::before {
|
|
26
|
+
.openapi-markdown__details.mime > summary::before {
|
|
28
27
|
top: 0.1rem;
|
|
29
28
|
}
|
|
29
|
+
|
|
30
|
+
.openapi-markdown__details.response > summary::before {
|
|
31
|
+
top: 0.25rem; /* TODO: figure out why this is necessary */
|
|
32
|
+
}
|
|
30
33
|
/* End of Top-Level Details Caret Styling */
|
|
31
34
|
|
|
32
35
|
.openapi-markdown__details {
|
|
@@ -7,30 +7,172 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
|
+
import Admonition from "@theme/Admonition";
|
|
10
11
|
import CodeBlock from "@theme/CodeBlock";
|
|
11
12
|
import ReactMarkdown from "react-markdown";
|
|
12
13
|
import rehypeRaw from "rehype-raw";
|
|
14
|
+
import remarkGfm from "remark-gfm";
|
|
15
|
+
|
|
16
|
+
function remarkAdmonition() {
|
|
17
|
+
return (tree) => {
|
|
18
|
+
const openingTagRegex = /^:::(\w+)(?:\[(.*?)\])?\s*$/;
|
|
19
|
+
const closingTagRegex = /^:::\s*$/;
|
|
20
|
+
const textOnlyAdmonition = /^:::(\w+)(?:\[(.*?)\])?\s*([\s\S]*?)\s*:::$/;
|
|
21
|
+
|
|
22
|
+
const nodes = [];
|
|
23
|
+
let bufferedChildren = [];
|
|
24
|
+
|
|
25
|
+
let insideAdmonition = false;
|
|
26
|
+
let type = null;
|
|
27
|
+
let title = null;
|
|
28
|
+
|
|
29
|
+
tree.children.forEach((node) => {
|
|
30
|
+
if (
|
|
31
|
+
node.type === "paragraph" &&
|
|
32
|
+
node.children.length === 1 &&
|
|
33
|
+
node.children[0].type === "text"
|
|
34
|
+
) {
|
|
35
|
+
const text = node.children[0].value.trim();
|
|
36
|
+
const openingMatch = text.match(openingTagRegex);
|
|
37
|
+
const closingMatch = text.match(closingTagRegex);
|
|
38
|
+
const textOnlyAdmonitionMatch = text.match(textOnlyAdmonition);
|
|
39
|
+
|
|
40
|
+
if (textOnlyAdmonitionMatch) {
|
|
41
|
+
const type = textOnlyAdmonitionMatch[1];
|
|
42
|
+
const title = textOnlyAdmonitionMatch[2]
|
|
43
|
+
? textOnlyAdmonitionMatch[2]?.trim()
|
|
44
|
+
: undefined;
|
|
45
|
+
const content = textOnlyAdmonitionMatch[3];
|
|
46
|
+
|
|
47
|
+
const admonitionNode = {
|
|
48
|
+
type: "admonition",
|
|
49
|
+
data: {
|
|
50
|
+
hName: "Admonition", // Tells ReactMarkdown to replace the node with Admonition component
|
|
51
|
+
hProperties: {
|
|
52
|
+
type, // Passed as a prop to the Admonition component
|
|
53
|
+
title,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
{
|
|
58
|
+
type: "text",
|
|
59
|
+
value: content?.trim(), // Trim leading/trailing whitespace
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
nodes.push(admonitionNode);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (openingMatch) {
|
|
68
|
+
type = openingMatch[1];
|
|
69
|
+
title = openingMatch[2] || type;
|
|
70
|
+
insideAdmonition = true;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (closingMatch && insideAdmonition) {
|
|
75
|
+
nodes.push({
|
|
76
|
+
type: "admonition",
|
|
77
|
+
data: {
|
|
78
|
+
hName: "Admonition",
|
|
79
|
+
hProperties: { type: type, title: title },
|
|
80
|
+
},
|
|
81
|
+
children: bufferedChildren,
|
|
82
|
+
});
|
|
83
|
+
bufferedChildren = [];
|
|
84
|
+
insideAdmonition = false;
|
|
85
|
+
type = null;
|
|
86
|
+
title = null;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (insideAdmonition) {
|
|
92
|
+
bufferedChildren.push(node);
|
|
93
|
+
} else {
|
|
94
|
+
nodes.push(node);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (bufferedChildren.length > 0 && type) {
|
|
99
|
+
nodes.push({
|
|
100
|
+
type: "admonition",
|
|
101
|
+
data: {
|
|
102
|
+
hName: "Admonition",
|
|
103
|
+
hProperties: { type: type, title: title },
|
|
104
|
+
},
|
|
105
|
+
children: bufferedChildren,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
tree.children = nodes;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function convertAstToHtmlStr(ast) {
|
|
113
|
+
if (!ast || !Array.isArray(ast)) {
|
|
114
|
+
return "";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const convertNode = (node) => {
|
|
118
|
+
switch (node.type) {
|
|
119
|
+
case "text":
|
|
120
|
+
return node.value;
|
|
121
|
+
case "element":
|
|
122
|
+
const { tagName, properties, children } = node;
|
|
123
|
+
|
|
124
|
+
// Convert attributes to a string
|
|
125
|
+
const attrs = properties
|
|
126
|
+
? Object.entries(properties)
|
|
127
|
+
.map(([key, value]) => `${key}="${value}"`)
|
|
128
|
+
.join(" ")
|
|
129
|
+
: "";
|
|
130
|
+
|
|
131
|
+
// Convert children to HTML
|
|
132
|
+
const childrenHtml = children ? children.map(convertNode).join("") : "";
|
|
133
|
+
|
|
134
|
+
return `<${tagName} ${attrs}>${childrenHtml}</${tagName}>`;
|
|
135
|
+
default:
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return ast.map(convertNode).join("");
|
|
141
|
+
}
|
|
13
142
|
|
|
14
143
|
function Markdown({ children }) {
|
|
15
144
|
return (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
145
|
+
<ReactMarkdown
|
|
146
|
+
rehypePlugins={[rehypeRaw]}
|
|
147
|
+
remarkPlugins={[remarkGfm, remarkAdmonition]}
|
|
148
|
+
components={{
|
|
149
|
+
pre: (props) => <div {...props} />,
|
|
150
|
+
code({ node, inline, className, children, ...props }) {
|
|
151
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
152
|
+
return match ? (
|
|
153
|
+
<CodeBlock className={className} language={match[1]} {...props}>
|
|
154
|
+
{children}
|
|
155
|
+
</CodeBlock>
|
|
156
|
+
) : (
|
|
157
|
+
<code className={className} {...props}>
|
|
158
|
+
{children}
|
|
159
|
+
</code>
|
|
160
|
+
);
|
|
161
|
+
},
|
|
162
|
+
admonition: ({ node, ...props }) => {
|
|
163
|
+
const type = node.data?.hProperties?.type || "note";
|
|
164
|
+
const title = node.data?.hProperties?.title || type;
|
|
165
|
+
const content = convertAstToHtmlStr(node.children);
|
|
166
|
+
return (
|
|
167
|
+
<Admonition type={type} title={title} {...props}>
|
|
168
|
+
<div dangerouslySetInnerHTML={{ __html: content }} />
|
|
169
|
+
</Admonition>
|
|
170
|
+
);
|
|
171
|
+
},
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
{children}
|
|
175
|
+
</ReactMarkdown>
|
|
34
176
|
);
|
|
35
177
|
}
|
|
36
178
|
|
|
@@ -12,15 +12,11 @@ var __importDefault =
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
|
-
const
|
|
15
|
+
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
16
16
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
17
17
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
18
18
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
19
19
|
const clsx_1 = __importDefault(require("clsx"));
|
|
20
|
-
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
21
|
-
const rehype_raw_1 = __importDefault(require("rehype-raw"));
|
|
22
|
-
const remark_gfm_1 = __importDefault(require("remark-gfm"));
|
|
23
|
-
const createDescription_1 = require("../../markdown/createDescription");
|
|
24
20
|
const schema_1 = require("../../markdown/schema");
|
|
25
21
|
const utils_1 = require("../../markdown/utils");
|
|
26
22
|
const getEnumDescriptionMarkdown = (enumDescriptions) => {
|
|
@@ -80,46 +76,13 @@ function ParamsItem({ param, ...rest }) {
|
|
|
80
76
|
"deprecated"
|
|
81
77
|
)
|
|
82
78
|
);
|
|
83
|
-
const
|
|
79
|
+
const renderQualifier = (0, utils_1.guard)(
|
|
84
80
|
(0, schema_1.getQualifierMessage)(schema),
|
|
85
|
-
(
|
|
86
|
-
react_1.default.createElement(
|
|
87
|
-
"div",
|
|
88
|
-
null,
|
|
89
|
-
react_1.default.createElement(react_markdown_1.default, {
|
|
90
|
-
children: (0, createDescription_1.createDescription)(message),
|
|
91
|
-
rehypePlugins: [rehype_raw_1.default],
|
|
92
|
-
})
|
|
93
|
-
)
|
|
81
|
+
(qualifier) =>
|
|
82
|
+
react_1.default.createElement(Markdown_1.default, null, qualifier)
|
|
94
83
|
);
|
|
95
84
|
const renderDescription = (0, utils_1.guard)(description, (description) =>
|
|
96
|
-
react_1.default.createElement(
|
|
97
|
-
react_1.default.Fragment,
|
|
98
|
-
null,
|
|
99
|
-
react_1.default.createElement(react_markdown_1.default, {
|
|
100
|
-
children: (0, createDescription_1.createDescription)(description),
|
|
101
|
-
components: {
|
|
102
|
-
pre: "div",
|
|
103
|
-
code({ node, inline, className, children, ...props }) {
|
|
104
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
105
|
-
if (inline)
|
|
106
|
-
return react_1.default.createElement("code", null, children);
|
|
107
|
-
return !inline && match
|
|
108
|
-
? react_1.default.createElement(
|
|
109
|
-
CodeBlock_1.default,
|
|
110
|
-
{ className: className },
|
|
111
|
-
children
|
|
112
|
-
)
|
|
113
|
-
: react_1.default.createElement(
|
|
114
|
-
CodeBlock_1.default,
|
|
115
|
-
null,
|
|
116
|
-
children
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
rehypePlugins: [rehype_raw_1.default],
|
|
121
|
-
})
|
|
122
|
-
)
|
|
85
|
+
react_1.default.createElement(Markdown_1.default, null, description)
|
|
123
86
|
);
|
|
124
87
|
const renderEnumDescriptions = (0, utils_1.guard)(
|
|
125
88
|
getEnumDescriptionMarkdown(enumDescriptions),
|
|
@@ -127,11 +90,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
127
90
|
return react_1.default.createElement(
|
|
128
91
|
"div",
|
|
129
92
|
{ style: { marginTop: ".5rem" } },
|
|
130
|
-
react_1.default.createElement(
|
|
131
|
-
rehypePlugins: [rehype_raw_1.default],
|
|
132
|
-
remarkPlugins: [remark_gfm_1.default],
|
|
133
|
-
children: value,
|
|
134
|
-
})
|
|
93
|
+
react_1.default.createElement(Markdown_1.default, null, value)
|
|
135
94
|
);
|
|
136
95
|
}
|
|
137
96
|
);
|
|
@@ -245,7 +204,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
245
204
|
renderSchemaRequired,
|
|
246
205
|
renderDeprecated
|
|
247
206
|
),
|
|
248
|
-
|
|
207
|
+
renderQualifier,
|
|
249
208
|
renderDescription,
|
|
250
209
|
renderEnumDescriptions,
|
|
251
210
|
renderDefaultValue(),
|
|
@@ -58,11 +58,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
58
58
|
const react_1 = __importStar(require("react"));
|
|
59
59
|
const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
60
60
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
61
|
+
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
61
62
|
const MimeTabs_1 = __importDefault(require("@theme/MimeTabs")); // Assume these components exist
|
|
62
63
|
const Schema_1 = __importDefault(require("@theme/Schema"));
|
|
63
64
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
64
65
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
65
|
-
const createDescription_1 = require("docusaurus-plugin-openapi-docs/lib/markdown/createDescription");
|
|
66
66
|
const RequestSchemaComponent = ({ title, body, style }) => {
|
|
67
67
|
if (
|
|
68
68
|
body === undefined ||
|
|
@@ -128,7 +128,11 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
128
128
|
react_1.default.createElement(
|
|
129
129
|
"div",
|
|
130
130
|
{ style: { marginTop: "1rem", marginBottom: "1rem" } },
|
|
131
|
-
|
|
131
|
+
react_1.default.createElement(
|
|
132
|
+
Markdown_1.default,
|
|
133
|
+
null,
|
|
134
|
+
body.description
|
|
135
|
+
)
|
|
132
136
|
)
|
|
133
137
|
),
|
|
134
138
|
react_1.default.createElement(
|
|
@@ -197,7 +201,11 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
197
201
|
react_1.default.createElement(
|
|
198
202
|
"div",
|
|
199
203
|
{ style: { marginTop: "1rem", marginBottom: "1rem" } },
|
|
200
|
-
|
|
204
|
+
react_1.default.createElement(
|
|
205
|
+
Markdown_1.default,
|
|
206
|
+
null,
|
|
207
|
+
body.description
|
|
208
|
+
)
|
|
201
209
|
)
|
|
202
210
|
),
|
|
203
211
|
react_1.default.createElement(
|
|
@@ -1,48 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare function json2xml(o: Record<string, any>, tab: string): string;
|
|
3
|
-
interface
|
|
4
|
-
in: string;
|
|
5
|
-
name: string;
|
|
6
|
-
schema?: {
|
|
7
|
-
type?: string;
|
|
8
|
-
items?: Record<string, any>;
|
|
9
|
-
};
|
|
10
|
-
enumDescriptions?: [string, string][];
|
|
11
|
-
}
|
|
12
|
-
interface ResponseHeaderProps {
|
|
13
|
-
description?: string;
|
|
14
|
-
example?: string;
|
|
15
|
-
schema?: {
|
|
16
|
-
type?: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
interface ResponseExampleProps {
|
|
20
|
-
value: any;
|
|
21
|
-
summary?: string;
|
|
22
|
-
}
|
|
23
|
-
interface Props {
|
|
24
|
-
parameters?: ParameterProps[];
|
|
25
|
-
type: string;
|
|
26
|
-
responseHeaders?: Record<string, ResponseHeaderProps>;
|
|
27
|
-
responseExamples?: Record<string, ResponseExampleProps>;
|
|
28
|
-
responseExample?: any;
|
|
29
|
-
schema?: any;
|
|
30
|
-
mimeType: string;
|
|
31
|
-
}
|
|
32
|
-
export declare const ParamsDetails: React.FC<Props>;
|
|
33
|
-
export declare const ResponseHeaders: React.FC<{
|
|
34
|
-
responseHeaders?: Record<string, ResponseHeaderProps>;
|
|
35
|
-
}>;
|
|
36
|
-
export declare const ResponseExamples: React.FC<{
|
|
3
|
+
interface ResponseExamplesProps {
|
|
37
4
|
responseExamples: any;
|
|
38
5
|
mimeType: string;
|
|
39
|
-
}
|
|
40
|
-
export declare const
|
|
6
|
+
}
|
|
7
|
+
export declare const ResponseExamples: React.FC<ResponseExamplesProps>;
|
|
8
|
+
interface ResponseExampleProps {
|
|
41
9
|
responseExample: any;
|
|
42
10
|
mimeType: string;
|
|
43
|
-
}
|
|
44
|
-
export declare const
|
|
11
|
+
}
|
|
12
|
+
export declare const ResponseExample: React.FC<ResponseExampleProps>;
|
|
13
|
+
interface ExampleFromSchemaProps {
|
|
45
14
|
schema: any;
|
|
46
15
|
mimeType: string;
|
|
47
|
-
}
|
|
16
|
+
}
|
|
17
|
+
export declare const ExampleFromSchema: React.FC<ExampleFromSchemaProps>;
|
|
48
18
|
export {};
|