docusaurus-theme-openapi-docs 5.0.1 → 5.1.0
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/schema.js +38 -15
- package/lib/markdown/schema.test.d.ts +1 -0
- package/lib/markdown/schema.test.js +86 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +4 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +9 -6
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Authorization/index.js +9 -10
- package/lib/theme/ApiExplorer/Body/index.js +4 -5
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +96 -61
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +12 -1
- package/lib/theme/ApiExplorer/CodeSnippets/languages.test.d.ts +1 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.test.js +102 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/CodeTabs/index.js +6 -5
- package/lib/theme/ApiExplorer/Export/index.js +9 -2
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +1 -2
- package/lib/theme/ApiExplorer/FormLabel/index.js +1 -2
- package/lib/theme/ApiExplorer/FormTextInput/index.js +1 -2
- package/lib/theme/ApiExplorer/LiveEditor/index.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +5 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +75 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +67 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +65 -1
- package/lib/theme/ApiExplorer/ParamOptions/index.js +2 -3
- package/lib/theme/ApiExplorer/Request/index.js +17 -18
- package/lib/theme/ApiExplorer/Response/index.js +54 -12
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +57 -50
- package/lib/theme/ApiExplorer/Server/index.js +2 -3
- package/lib/theme/ApiItem/index.js +59 -33
- package/lib/theme/ApiTabs/index.d.ts +1 -1
- package/lib/theme/ApiTabs/index.js +7 -7
- package/lib/theme/DiscriminatorTabs/index.d.ts +1 -1
- package/lib/theme/DiscriminatorTabs/index.js +6 -5
- package/lib/theme/Example/index.js +3 -4
- package/lib/theme/MimeTabs/index.d.ts +1 -1
- package/lib/theme/MimeTabs/index.js +6 -5
- package/lib/theme/OperationTabs/index.d.ts +1 -1
- package/lib/theme/OperationTabs/index.js +6 -5
- package/lib/theme/ParamsDetails/index.js +1 -2
- package/lib/theme/ParamsItem/index.js +7 -8
- package/lib/theme/RequestSchema/index.js +57 -57
- package/lib/theme/ResponseExamples/index.js +3 -4
- package/lib/theme/ResponseSchema/index.js +26 -24
- package/lib/theme/Schema/index.js +148 -27
- package/lib/theme/SchemaExpansion/_SchemaExpansion.scss +113 -0
- package/lib/theme/SchemaExpansion/context.d.ts +24 -0
- package/lib/theme/SchemaExpansion/context.js +187 -0
- package/lib/theme/SchemaExpansion/index.d.ts +4 -0
- package/lib/theme/SchemaExpansion/index.js +314 -0
- package/lib/theme/SchemaItem/index.js +9 -10
- package/lib/theme/SchemaTabs/index.d.ts +1 -1
- package/lib/theme/SchemaTabs/index.js +6 -5
- package/lib/theme/StatusCodes/index.js +2 -4
- package/lib/theme/TabItem/index.d.ts +5 -0
- package/lib/theme/TabItem/index.js +51 -0
- package/lib/theme/TabItem/styles.module.css +3 -0
- package/lib/theme/Tabs/index.d.ts +5 -0
- package/lib/theme/Tabs/index.js +148 -0
- package/lib/theme/Tabs/styles.module.css +7 -0
- package/lib/theme/styles.scss +1 -0
- package/lib/theme/translationIds.d.ts +1 -93
- package/lib/theme/translationIds.js +0 -109
- package/lib/theme/utils/codeBlockUtils.d.ts +28 -0
- package/lib/theme/utils/codeBlockUtils.js +223 -0
- package/lib/theme/utils/reactUtils.d.ts +1 -0
- package/lib/theme/utils/reactUtils.js +23 -0
- package/lib/theme/utils/scrollUtils.d.ts +7 -0
- package/lib/theme/utils/scrollUtils.js +175 -0
- package/lib/theme/utils/tabsUtils.d.ts +47 -0
- package/lib/theme/utils/tabsUtils.js +299 -0
- package/lib/theme/utils/useCodeWordWrap.d.ts +8 -0
- package/lib/theme/utils/useCodeWordWrap.js +84 -0
- package/lib/theme/utils/useMutationObserver.d.ts +3 -0
- package/lib/theme/utils/useMutationObserver.js +34 -0
- package/package.json +4 -4
- package/src/markdown/schema.test.ts +102 -0
- package/src/markdown/schema.ts +42 -15
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +8 -7
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +1 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +9 -10
- package/src/theme/ApiExplorer/Body/index.tsx +7 -5
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +103 -59
- package/src/theme/ApiExplorer/CodeSnippets/languages.test.ts +109 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +13 -1
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +5 -5
- package/src/theme/ApiExplorer/Export/index.tsx +6 -2
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +1 -2
- package/src/theme/ApiExplorer/FormLabel/index.tsx +1 -2
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +1 -2
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +5 -3
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +20 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +15 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +11 -1
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +2 -3
- package/src/theme/ApiExplorer/Request/index.tsx +23 -18
- package/src/theme/ApiExplorer/Response/index.tsx +63 -9
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +60 -52
- package/src/theme/ApiExplorer/Server/index.tsx +8 -3
- package/src/theme/ApiItem/index.tsx +43 -21
- package/src/theme/ApiTabs/index.tsx +8 -8
- package/src/theme/DiscriminatorTabs/index.tsx +6 -5
- package/src/theme/Example/index.tsx +3 -4
- package/src/theme/MimeTabs/index.tsx +9 -8
- package/src/theme/OperationTabs/index.tsx +5 -4
- package/src/theme/ParamsDetails/index.tsx +1 -2
- package/src/theme/ParamsItem/index.tsx +13 -8
- package/src/theme/RequestSchema/index.tsx +38 -40
- package/src/theme/ResponseExamples/index.tsx +3 -4
- package/src/theme/ResponseSchema/index.tsx +16 -17
- package/src/theme/Schema/index.tsx +156 -27
- package/src/theme/SchemaExpansion/_SchemaExpansion.scss +113 -0
- package/src/theme/SchemaExpansion/context.tsx +154 -0
- package/src/theme/SchemaExpansion/index.tsx +236 -0
- package/src/theme/SchemaItem/index.tsx +18 -10
- package/src/theme/SchemaTabs/index.tsx +6 -5
- package/src/theme/StatusCodes/index.tsx +2 -3
- package/src/theme/TabItem/index.tsx +61 -0
- package/src/theme/TabItem/styles.module.css +3 -0
- package/src/theme/Tabs/index.tsx +164 -0
- package/src/theme/Tabs/styles.module.css +7 -0
- package/src/theme/styles.scss +1 -0
- package/src/theme/translationIds.ts +37 -106
- package/src/theme/utils/codeBlockUtils.ts +296 -0
- package/src/theme/utils/reactUtils.ts +22 -0
- package/src/theme/utils/scrollUtils.tsx +153 -0
- package/src/theme/utils/tabsUtils.tsx +329 -0
- package/src/theme/utils/useCodeWordWrap.ts +110 -0
- package/src/theme/utils/useMutationObserver.ts +43 -0
- package/src/theme-classic.d.ts +0 -96
- package/src/types.d.ts +27 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -85,14 +85,13 @@ const buildPostmanRequest_1 = __importDefault(
|
|
|
85
85
|
const ContentType_1 = __importDefault(
|
|
86
86
|
require("@theme/ApiExplorer/ContentType")
|
|
87
87
|
);
|
|
88
|
+
const useResolvedEncoding_1 = require("@theme/ApiExplorer/EncodingSelection/useResolvedEncoding");
|
|
88
89
|
const ParamOptions_1 = __importDefault(
|
|
89
90
|
require("@theme/ApiExplorer/ParamOptions")
|
|
90
91
|
);
|
|
91
92
|
const slice_1 = require("@theme/ApiExplorer/Response/slice");
|
|
92
93
|
const Server_1 = __importDefault(require("@theme/ApiExplorer/Server"));
|
|
93
|
-
const useResolvedEncoding_1 = require("@theme/ApiExplorer/EncodingSelection/useResolvedEncoding");
|
|
94
94
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
95
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
96
95
|
const sdk = __importStar(require("postman-collection"));
|
|
97
96
|
const react_hook_form_1 = require("react-hook-form");
|
|
98
97
|
const makeRequest_1 = __importStar(require("./makeRequest"));
|
|
@@ -200,26 +199,26 @@ function Request({ item }) {
|
|
|
200
199
|
switch (errorType) {
|
|
201
200
|
case "timeout":
|
|
202
201
|
return (0, Translate_1.translate)({
|
|
203
|
-
id:
|
|
202
|
+
id: "theme.openapi.request.error.timeout",
|
|
204
203
|
message:
|
|
205
204
|
"The request timed out waiting for the server to respond. Please try again. If the issue persists, try using a different client (e.g., curl) with a longer timeout.",
|
|
206
205
|
});
|
|
207
206
|
case "network":
|
|
208
207
|
return (0, Translate_1.translate)({
|
|
209
|
-
id:
|
|
208
|
+
id: "theme.openapi.request.error.network",
|
|
210
209
|
message:
|
|
211
210
|
"Unable to reach the server. Please check your network connection and verify the server URL is correct. If the server is running, this may be a CORS issue.",
|
|
212
211
|
});
|
|
213
212
|
case "cors":
|
|
214
213
|
return (0, Translate_1.translate)({
|
|
215
|
-
id:
|
|
214
|
+
id: "theme.openapi.request.error.cors",
|
|
216
215
|
message:
|
|
217
216
|
"The request was blocked, possibly due to CORS restrictions. Ensure the server allows requests from this origin, or try using a proxy.",
|
|
218
217
|
});
|
|
219
218
|
case "unknown":
|
|
220
219
|
default:
|
|
221
220
|
return (0, Translate_1.translate)({
|
|
222
|
-
id:
|
|
221
|
+
id: "theme.openapi.request.error.unknown",
|
|
223
222
|
message:
|
|
224
223
|
"An unexpected error occurred while making the request. Please try again.",
|
|
225
224
|
});
|
|
@@ -229,7 +228,7 @@ function Request({ item }) {
|
|
|
229
228
|
dispatch(
|
|
230
229
|
(0, slice_1.setResponse)(
|
|
231
230
|
(0, Translate_1.translate)({
|
|
232
|
-
id:
|
|
231
|
+
id: "theme.openapi.request.fetchingMessage",
|
|
233
232
|
message: "Fetching...",
|
|
234
233
|
})
|
|
235
234
|
)
|
|
@@ -256,7 +255,7 @@ function Request({ item }) {
|
|
|
256
255
|
errorMessage = getErrorMessage(e.type);
|
|
257
256
|
} else {
|
|
258
257
|
errorMessage = (0, Translate_1.translate)({
|
|
259
|
-
id:
|
|
258
|
+
id: "theme.openapi.request.connectionFailed",
|
|
260
259
|
message: "Connection failed",
|
|
261
260
|
});
|
|
262
261
|
}
|
|
@@ -314,7 +313,7 @@ function Request({ item }) {
|
|
|
314
313
|
"span",
|
|
315
314
|
{ className: "openapi-explorer__request-title" },
|
|
316
315
|
(0, Translate_1.translate)({
|
|
317
|
-
id:
|
|
316
|
+
id: "theme.openapi.request.title",
|
|
318
317
|
message: "Request",
|
|
319
318
|
})
|
|
320
319
|
),
|
|
@@ -327,7 +326,7 @@ function Request({ item }) {
|
|
|
327
326
|
onClick: collapseAllDetails,
|
|
328
327
|
},
|
|
329
328
|
(0, Translate_1.translate)({
|
|
330
|
-
id:
|
|
329
|
+
id: "theme.openapi.request.collapseAll",
|
|
331
330
|
message: "Collapse all",
|
|
332
331
|
})
|
|
333
332
|
)
|
|
@@ -339,7 +338,7 @@ function Request({ item }) {
|
|
|
339
338
|
onClick: expandAllDetails,
|
|
340
339
|
},
|
|
341
340
|
(0, Translate_1.translate)({
|
|
342
|
-
id:
|
|
341
|
+
id: "theme.openapi.request.expandAll",
|
|
343
342
|
message: "Expand all",
|
|
344
343
|
})
|
|
345
344
|
)
|
|
@@ -366,7 +365,7 @@ function Request({ item }) {
|
|
|
366
365
|
},
|
|
367
366
|
},
|
|
368
367
|
(0, Translate_1.translate)({
|
|
369
|
-
id:
|
|
368
|
+
id: "theme.openapi.request.baseUrl.title",
|
|
370
369
|
message: "Base URL",
|
|
371
370
|
})
|
|
372
371
|
),
|
|
@@ -391,7 +390,7 @@ function Request({ item }) {
|
|
|
391
390
|
},
|
|
392
391
|
},
|
|
393
392
|
(0, Translate_1.translate)({
|
|
394
|
-
id:
|
|
393
|
+
id: "theme.openapi.request.auth.title",
|
|
395
394
|
message: "Auth",
|
|
396
395
|
})
|
|
397
396
|
),
|
|
@@ -415,7 +414,7 @@ function Request({ item }) {
|
|
|
415
414
|
},
|
|
416
415
|
},
|
|
417
416
|
(0, Translate_1.translate)({
|
|
418
|
-
id:
|
|
417
|
+
id: "theme.openapi.request.parameters.title",
|
|
419
418
|
message: "Parameters",
|
|
420
419
|
})
|
|
421
420
|
),
|
|
@@ -438,7 +437,7 @@ function Request({ item }) {
|
|
|
438
437
|
},
|
|
439
438
|
},
|
|
440
439
|
(0, Translate_1.translate)({
|
|
441
|
-
id:
|
|
440
|
+
id: "theme.openapi.request.body.title",
|
|
442
441
|
message: "Body",
|
|
443
442
|
}),
|
|
444
443
|
requestBodyRequired &&
|
|
@@ -447,7 +446,7 @@ function Request({ item }) {
|
|
|
447
446
|
{ className: "openapi-schema__required" },
|
|
448
447
|
"\u00A0",
|
|
449
448
|
(0, Translate_1.translate)({
|
|
450
|
-
id:
|
|
449
|
+
id: "theme.openapi.request.requiredLabel",
|
|
451
450
|
message: "required",
|
|
452
451
|
})
|
|
453
452
|
)
|
|
@@ -480,7 +479,7 @@ function Request({ item }) {
|
|
|
480
479
|
},
|
|
481
480
|
},
|
|
482
481
|
(0, Translate_1.translate)({
|
|
483
|
-
id:
|
|
482
|
+
id: "theme.openapi.request.accept.title",
|
|
484
483
|
message: "Accept",
|
|
485
484
|
})
|
|
486
485
|
),
|
|
@@ -492,7 +491,7 @@ function Request({ item }) {
|
|
|
492
491
|
"button",
|
|
493
492
|
{ className: "openapi-explorer__request-btn", type: "submit" },
|
|
494
493
|
(0, Translate_1.translate)({
|
|
495
|
-
id:
|
|
494
|
+
id: "theme.openapi.request.sendButton",
|
|
496
495
|
message: "Send API Request",
|
|
497
496
|
})
|
|
498
497
|
)
|
|
@@ -80,9 +80,53 @@ const ApiCodeBlock_1 = __importDefault(
|
|
|
80
80
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
81
81
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
82
82
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
83
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
84
83
|
const clsx_1 = __importDefault(require("clsx"));
|
|
85
84
|
const slice_1 = require("./slice");
|
|
85
|
+
// Pretty-print a JSON string by re-indenting structural tokens only.
|
|
86
|
+
// Numbers pass through verbatim, so values beyond Number.MAX_SAFE_INTEGER
|
|
87
|
+
// (e.g. 19-digit IDs) keep their exact digits. Issue #1208.
|
|
88
|
+
function prettyPrintJson(raw, indent = 2) {
|
|
89
|
+
const pad = " ".repeat(indent);
|
|
90
|
+
let out = "";
|
|
91
|
+
let depth = 0;
|
|
92
|
+
let inString = false;
|
|
93
|
+
let escape = false;
|
|
94
|
+
for (let i = 0; i < raw.length; i++) {
|
|
95
|
+
const ch = raw[i];
|
|
96
|
+
if (inString) {
|
|
97
|
+
out += ch;
|
|
98
|
+
if (escape) escape = false;
|
|
99
|
+
else if (ch === "\\") escape = true;
|
|
100
|
+
else if (ch === '"') inString = false;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (ch === " " || ch === "\t" || ch === "\n" || ch === "\r") continue;
|
|
104
|
+
if (ch === '"') {
|
|
105
|
+
out += ch;
|
|
106
|
+
inString = true;
|
|
107
|
+
} else if (ch === "{" || ch === "[") {
|
|
108
|
+
let j = i + 1;
|
|
109
|
+
while (j < raw.length && /\s/.test(raw[j])) j++;
|
|
110
|
+
if (raw[j] === "}" || raw[j] === "]") {
|
|
111
|
+
out += ch + raw[j];
|
|
112
|
+
i = j;
|
|
113
|
+
} else {
|
|
114
|
+
depth++;
|
|
115
|
+
out += ch + "\n" + pad.repeat(depth);
|
|
116
|
+
}
|
|
117
|
+
} else if (ch === "}" || ch === "]") {
|
|
118
|
+
depth--;
|
|
119
|
+
out += "\n" + pad.repeat(depth) + ch;
|
|
120
|
+
} else if (ch === ",") {
|
|
121
|
+
out += ",\n" + pad.repeat(depth);
|
|
122
|
+
} else if (ch === ":") {
|
|
123
|
+
out += ": ";
|
|
124
|
+
} else {
|
|
125
|
+
out += ch;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
86
130
|
// TODO: We probably shouldn't attempt to format XML...
|
|
87
131
|
function formatXml(xml) {
|
|
88
132
|
const tab = " ";
|
|
@@ -130,7 +174,8 @@ function Response({ item }) {
|
|
|
130
174
|
let prettyResponse = response;
|
|
131
175
|
if (prettyResponse) {
|
|
132
176
|
try {
|
|
133
|
-
|
|
177
|
+
JSON.parse(response);
|
|
178
|
+
prettyResponse = prettyPrintJson(response);
|
|
134
179
|
} catch {
|
|
135
180
|
if (response.startsWith("<")) {
|
|
136
181
|
prettyResponse = formatXml(response);
|
|
@@ -147,7 +192,7 @@ function Response({ item }) {
|
|
|
147
192
|
"span",
|
|
148
193
|
{ className: "openapi-explorer__response-title" },
|
|
149
194
|
(0, Translate_1.translate)({
|
|
150
|
-
id:
|
|
195
|
+
id: "theme.openapi.response.title",
|
|
151
196
|
message: "Response",
|
|
152
197
|
})
|
|
153
198
|
),
|
|
@@ -163,7 +208,7 @@ function Response({ item }) {
|
|
|
163
208
|
},
|
|
164
209
|
},
|
|
165
210
|
(0, Translate_1.translate)({
|
|
166
|
-
id:
|
|
211
|
+
id: "theme.openapi.response.clear",
|
|
167
212
|
message: "Clear",
|
|
168
213
|
})
|
|
169
214
|
)
|
|
@@ -217,17 +262,14 @@ function Response({ item }) {
|
|
|
217
262
|
react_1.default.createElement(
|
|
218
263
|
Translate_1.default,
|
|
219
264
|
{
|
|
220
|
-
id:
|
|
265
|
+
id: "theme.openapi.response.placeholder",
|
|
221
266
|
values: {
|
|
222
267
|
code: react_1.default.createElement(
|
|
223
268
|
"code",
|
|
224
269
|
null,
|
|
225
270
|
react_1.default.createElement(
|
|
226
271
|
Translate_1.default,
|
|
227
|
-
{
|
|
228
|
-
id: translationIds_1.OPENAPI_REQUEST
|
|
229
|
-
.SEND_BUTTON,
|
|
230
|
-
},
|
|
272
|
+
{ id: "theme.openapi.request.sendButton" },
|
|
231
273
|
"Send API Request"
|
|
232
274
|
)
|
|
233
275
|
),
|
|
@@ -242,7 +284,7 @@ function Response({ item }) {
|
|
|
242
284
|
TabItem_1.default,
|
|
243
285
|
{
|
|
244
286
|
label: (0, Translate_1.translate)({
|
|
245
|
-
id:
|
|
287
|
+
id: "theme.openapi.response.headersTab",
|
|
246
288
|
message: "Headers",
|
|
247
289
|
}),
|
|
248
290
|
value: "headers",
|
|
@@ -277,14 +319,14 @@ function Response({ item }) {
|
|
|
277
319
|
react_1.default.createElement(
|
|
278
320
|
Translate_1.default,
|
|
279
321
|
{
|
|
280
|
-
id:
|
|
322
|
+
id: "theme.openapi.response.placeholder",
|
|
281
323
|
values: {
|
|
282
324
|
code: react_1.default.createElement(
|
|
283
325
|
"code",
|
|
284
326
|
null,
|
|
285
327
|
react_1.default.createElement(
|
|
286
328
|
Translate_1.default,
|
|
287
|
-
{ id:
|
|
329
|
+
{ id: "theme.openapi.request.sendButton" },
|
|
288
330
|
"Send API Request"
|
|
289
331
|
)
|
|
290
332
|
),
|
|
@@ -15,7 +15,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
15
15
|
const Link_1 = __importDefault(require("@docusaurus/Link"));
|
|
16
16
|
const Translate_1 = require("@docusaurus/Translate");
|
|
17
17
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
18
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
19
18
|
function SecuritySchemes(props) {
|
|
20
19
|
const options = (0, hooks_1.useTypedSelector)((state) => state.auth.options);
|
|
21
20
|
const selected = (0, hooks_1.useTypedSelector)(
|
|
@@ -27,42 +26,46 @@ function SecuritySchemes(props) {
|
|
|
27
26
|
return null;
|
|
28
27
|
}
|
|
29
28
|
const selectedAuth = options[selected];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
// Each label uses a static `translate()` call (literal id + message) so that
|
|
30
|
+
// `docusaurus write-translations` can statically extract it. A dynamic
|
|
31
|
+
// `translate({ id: someVar })` would be skipped by the extractor.
|
|
32
|
+
const renderRestLabel = (k) => {
|
|
33
|
+
switch (k) {
|
|
34
|
+
case "description":
|
|
35
|
+
return (0, Translate_1.translate)({
|
|
36
|
+
id: "theme.openapi.securitySchemes.description",
|
|
37
|
+
message: "description:",
|
|
38
|
+
});
|
|
39
|
+
case "scheme":
|
|
40
|
+
return (0, Translate_1.translate)({
|
|
41
|
+
id: "theme.openapi.securitySchemes.scheme",
|
|
42
|
+
message: "scheme:",
|
|
43
|
+
});
|
|
44
|
+
case "bearerFormat":
|
|
45
|
+
return (0, Translate_1.translate)({
|
|
46
|
+
id: "theme.openapi.securitySchemes.bearerFormat",
|
|
47
|
+
message: "bearerFormat:",
|
|
48
|
+
});
|
|
49
|
+
case "openIdConnectUrl":
|
|
50
|
+
return (0, Translate_1.translate)({
|
|
51
|
+
id: "theme.openapi.securitySchemes.openIdConnectUrl",
|
|
52
|
+
message: "openIdConnectUrl:",
|
|
53
|
+
});
|
|
54
|
+
default:
|
|
55
|
+
return `${k}:`;
|
|
56
|
+
}
|
|
47
57
|
};
|
|
48
58
|
const renderRest = (rest) =>
|
|
49
|
-
Object.keys(rest).map((k) =>
|
|
50
|
-
|
|
51
|
-
const label = translation
|
|
52
|
-
? (0, Translate_1.translate)({
|
|
53
|
-
id: translation.id,
|
|
54
|
-
message: translation.message,
|
|
55
|
-
})
|
|
56
|
-
: `${k}:`;
|
|
57
|
-
return react_1.default.createElement(
|
|
59
|
+
Object.keys(rest).map((k) =>
|
|
60
|
+
react_1.default.createElement(
|
|
58
61
|
"span",
|
|
59
62
|
{ key: k },
|
|
60
|
-
react_1.default.createElement("strong", null,
|
|
63
|
+
react_1.default.createElement("strong", null, renderRestLabel(k), " "),
|
|
61
64
|
typeof rest[k] === "object"
|
|
62
65
|
? JSON.stringify(rest[k], null, 2)
|
|
63
66
|
: String(rest[k])
|
|
64
|
-
)
|
|
65
|
-
|
|
67
|
+
)
|
|
68
|
+
);
|
|
66
69
|
return react_1.default.createElement(
|
|
67
70
|
"details",
|
|
68
71
|
{ className: "openapi-security__details", open: false },
|
|
@@ -72,7 +75,11 @@ function SecuritySchemes(props) {
|
|
|
72
75
|
react_1.default.createElement(
|
|
73
76
|
"h4",
|
|
74
77
|
{ className: "openapi-security__summary-header" },
|
|
75
|
-
|
|
78
|
+
(0, Translate_1.translate)({
|
|
79
|
+
id: "theme.openapi.securitySchemes.authorization",
|
|
80
|
+
message: "Authorization:",
|
|
81
|
+
}),
|
|
82
|
+
" ",
|
|
76
83
|
selectedAuth[0].name ?? selectedAuth[0].type
|
|
77
84
|
)
|
|
78
85
|
),
|
|
@@ -103,7 +110,7 @@ function SecuritySchemes(props) {
|
|
|
103
110
|
"strong",
|
|
104
111
|
null,
|
|
105
112
|
(0, Translate_1.translate)({
|
|
106
|
-
id:
|
|
113
|
+
id: "theme.openapi.securitySchemes.name",
|
|
107
114
|
message: "name:",
|
|
108
115
|
})
|
|
109
116
|
),
|
|
@@ -121,7 +128,7 @@ function SecuritySchemes(props) {
|
|
|
121
128
|
"strong",
|
|
122
129
|
null,
|
|
123
130
|
(0, Translate_1.translate)({
|
|
124
|
-
id:
|
|
131
|
+
id: "theme.openapi.securitySchemes.type",
|
|
125
132
|
message: "type:",
|
|
126
133
|
})
|
|
127
134
|
),
|
|
@@ -137,7 +144,7 @@ function SecuritySchemes(props) {
|
|
|
137
144
|
"strong",
|
|
138
145
|
null,
|
|
139
146
|
(0, Translate_1.translate)({
|
|
140
|
-
id:
|
|
147
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
141
148
|
message: "scopes:",
|
|
142
149
|
})
|
|
143
150
|
),
|
|
@@ -173,7 +180,7 @@ function SecuritySchemes(props) {
|
|
|
173
180
|
"strong",
|
|
174
181
|
null,
|
|
175
182
|
(0, Translate_1.translate)({
|
|
176
|
-
id:
|
|
183
|
+
id: "theme.openapi.securitySchemes.name",
|
|
177
184
|
message: "name:",
|
|
178
185
|
})
|
|
179
186
|
),
|
|
@@ -191,7 +198,7 @@ function SecuritySchemes(props) {
|
|
|
191
198
|
"strong",
|
|
192
199
|
null,
|
|
193
200
|
(0, Translate_1.translate)({
|
|
194
|
-
id:
|
|
201
|
+
id: "theme.openapi.securitySchemes.type",
|
|
195
202
|
message: "type:",
|
|
196
203
|
})
|
|
197
204
|
),
|
|
@@ -207,7 +214,7 @@ function SecuritySchemes(props) {
|
|
|
207
214
|
"strong",
|
|
208
215
|
null,
|
|
209
216
|
(0, Translate_1.translate)({
|
|
210
|
-
id:
|
|
217
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
211
218
|
message: "scopes:",
|
|
212
219
|
})
|
|
213
220
|
),
|
|
@@ -241,7 +248,7 @@ function SecuritySchemes(props) {
|
|
|
241
248
|
"strong",
|
|
242
249
|
null,
|
|
243
250
|
(0, Translate_1.translate)({
|
|
244
|
-
id:
|
|
251
|
+
id: "theme.openapi.securitySchemes.name",
|
|
245
252
|
message: "name:",
|
|
246
253
|
})
|
|
247
254
|
),
|
|
@@ -259,7 +266,7 @@ function SecuritySchemes(props) {
|
|
|
259
266
|
"strong",
|
|
260
267
|
null,
|
|
261
268
|
(0, Translate_1.translate)({
|
|
262
|
-
id:
|
|
269
|
+
id: "theme.openapi.securitySchemes.type",
|
|
263
270
|
message: "type:",
|
|
264
271
|
})
|
|
265
272
|
),
|
|
@@ -273,7 +280,7 @@ function SecuritySchemes(props) {
|
|
|
273
280
|
"strong",
|
|
274
281
|
null,
|
|
275
282
|
(0, Translate_1.translate)({
|
|
276
|
-
id:
|
|
283
|
+
id: "theme.openapi.securitySchemes.in",
|
|
277
284
|
message: "in:",
|
|
278
285
|
})
|
|
279
286
|
),
|
|
@@ -304,7 +311,7 @@ function SecuritySchemes(props) {
|
|
|
304
311
|
"strong",
|
|
305
312
|
null,
|
|
306
313
|
(0, Translate_1.translate)({
|
|
307
|
-
id:
|
|
314
|
+
id: "theme.openapi.securitySchemes.name",
|
|
308
315
|
message: "name:",
|
|
309
316
|
})
|
|
310
317
|
),
|
|
@@ -322,7 +329,7 @@ function SecuritySchemes(props) {
|
|
|
322
329
|
"strong",
|
|
323
330
|
null,
|
|
324
331
|
(0, Translate_1.translate)({
|
|
325
|
-
id:
|
|
332
|
+
id: "theme.openapi.securitySchemes.type",
|
|
326
333
|
message: "type:",
|
|
327
334
|
})
|
|
328
335
|
),
|
|
@@ -338,7 +345,7 @@ function SecuritySchemes(props) {
|
|
|
338
345
|
"strong",
|
|
339
346
|
null,
|
|
340
347
|
(0, Translate_1.translate)({
|
|
341
|
-
id:
|
|
348
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
342
349
|
message: "scopes:",
|
|
343
350
|
})
|
|
344
351
|
),
|
|
@@ -374,7 +381,7 @@ function SecuritySchemes(props) {
|
|
|
374
381
|
"strong",
|
|
375
382
|
null,
|
|
376
383
|
(0, Translate_1.translate)({
|
|
377
|
-
id:
|
|
384
|
+
id: "theme.openapi.securitySchemes.name",
|
|
378
385
|
message: "name:",
|
|
379
386
|
})
|
|
380
387
|
),
|
|
@@ -392,7 +399,7 @@ function SecuritySchemes(props) {
|
|
|
392
399
|
"strong",
|
|
393
400
|
null,
|
|
394
401
|
(0, Translate_1.translate)({
|
|
395
|
-
id:
|
|
402
|
+
id: "theme.openapi.securitySchemes.type",
|
|
396
403
|
message: "type:",
|
|
397
404
|
})
|
|
398
405
|
),
|
|
@@ -408,7 +415,7 @@ function SecuritySchemes(props) {
|
|
|
408
415
|
"strong",
|
|
409
416
|
null,
|
|
410
417
|
(0, Translate_1.translate)({
|
|
411
|
-
id:
|
|
418
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
412
419
|
message: "scopes:",
|
|
413
420
|
})
|
|
414
421
|
),
|
|
@@ -431,7 +438,7 @@ function SecuritySchemes(props) {
|
|
|
431
438
|
"strong",
|
|
432
439
|
null,
|
|
433
440
|
(0, Translate_1.translate)({
|
|
434
|
-
id:
|
|
441
|
+
id: "theme.openapi.securitySchemes.flows",
|
|
435
442
|
message: "flows:",
|
|
436
443
|
})
|
|
437
444
|
),
|
|
@@ -463,7 +470,7 @@ function SecuritySchemes(props) {
|
|
|
463
470
|
"strong",
|
|
464
471
|
null,
|
|
465
472
|
(0, Translate_1.translate)({
|
|
466
|
-
id:
|
|
473
|
+
id: "theme.openapi.securitySchemes.name",
|
|
467
474
|
message: "name:",
|
|
468
475
|
})
|
|
469
476
|
),
|
|
@@ -481,7 +488,7 @@ function SecuritySchemes(props) {
|
|
|
481
488
|
"strong",
|
|
482
489
|
null,
|
|
483
490
|
(0, Translate_1.translate)({
|
|
484
|
-
id:
|
|
491
|
+
id: "theme.openapi.securitySchemes.type",
|
|
485
492
|
message: "type:",
|
|
486
493
|
})
|
|
487
494
|
),
|
|
@@ -497,7 +504,7 @@ function SecuritySchemes(props) {
|
|
|
497
504
|
"strong",
|
|
498
505
|
null,
|
|
499
506
|
(0, Translate_1.translate)({
|
|
500
|
-
id:
|
|
507
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
501
508
|
message: "scopes:",
|
|
502
509
|
})
|
|
503
510
|
),
|
|
@@ -78,7 +78,6 @@ const FormTextInput_1 = __importDefault(
|
|
|
78
78
|
require("@theme/ApiExplorer/FormTextInput")
|
|
79
79
|
);
|
|
80
80
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
81
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
82
81
|
const slice_1 = require("./slice");
|
|
83
82
|
function Server({ labelId }) {
|
|
84
83
|
const [isEditing, setIsEditing] = (0, react_1.useState)(false);
|
|
@@ -123,7 +122,7 @@ function Server({ labelId }) {
|
|
|
123
122
|
{
|
|
124
123
|
onClick: () => setIsEditing(true),
|
|
125
124
|
label: (0, Translate_1.translate)({
|
|
126
|
-
id:
|
|
125
|
+
id: "theme.openapi.server.editButton",
|
|
127
126
|
message: "Edit",
|
|
128
127
|
}),
|
|
129
128
|
},
|
|
@@ -146,7 +145,7 @@ function Server({ labelId }) {
|
|
|
146
145
|
{
|
|
147
146
|
onClick: () => setIsEditing(false),
|
|
148
147
|
label: (0, Translate_1.translate)({
|
|
149
|
-
id:
|
|
148
|
+
id: "theme.openapi.server.hideButton",
|
|
150
149
|
message: "Hide",
|
|
151
150
|
}),
|
|
152
151
|
},
|