docusaurus-theme-openapi-docs 0.0.0-1294 → 0.0.0-1310
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 +4 -5
- 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/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 +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +1 -2
- 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 +7 -11
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +57 -50
- package/lib/theme/ApiExplorer/Server/index.js +2 -3
- 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 +4 -6
- package/lib/theme/ResponseExamples/index.js +3 -4
- package/lib/theme/ResponseSchema/index.js +2 -3
- package/lib/theme/Schema/index.js +8 -9
- package/lib/theme/SchemaExpansion/index.js +4 -5
- 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/translationIds.d.ts +1 -99
- package/lib/theme/translationIds.js +0 -116
- 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.ts +4 -5
- 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/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 +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +1 -2
- 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 +10 -8
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +60 -52
- package/src/theme/ApiExplorer/Server/index.tsx +8 -3
- 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 +4 -5
- package/src/theme/ResponseExamples/index.tsx +3 -4
- package/src/theme/ResponseSchema/index.tsx +2 -3
- package/src/theme/Schema/index.tsx +8 -9
- package/src/theme/SchemaExpansion/index.tsx +4 -5
- 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/translationIds.ts +37 -113
- 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/tsconfig.tsbuildinfo +1 -1
|
@@ -10,7 +10,6 @@ import React from "react";
|
|
|
10
10
|
import Link from "@docusaurus/Link";
|
|
11
11
|
import { translate } from "@docusaurus/Translate";
|
|
12
12
|
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
13
|
-
import { OPENAPI_SECURITY_SCHEMES } from "@theme/translationIds";
|
|
14
13
|
|
|
15
14
|
function SecuritySchemes(props: any) {
|
|
16
15
|
const options = useTypedSelector((state: any) => state.auth.options);
|
|
@@ -25,45 +24,54 @@ function SecuritySchemes(props: any) {
|
|
|
25
24
|
|
|
26
25
|
const selectedAuth = options[selected];
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
// Each label uses a static `translate()` call (literal id + message) so that
|
|
28
|
+
// `docusaurus write-translations` can statically extract it. A dynamic
|
|
29
|
+
// `translate({ id: someVar })` would be skipped by the extractor.
|
|
30
|
+
const renderRestLabel = (k: string): string => {
|
|
31
|
+
switch (k) {
|
|
32
|
+
case "description":
|
|
33
|
+
return translate({
|
|
34
|
+
id: "theme.openapi.securitySchemes.description",
|
|
35
|
+
message: "description:",
|
|
36
|
+
});
|
|
37
|
+
case "scheme":
|
|
38
|
+
return translate({
|
|
39
|
+
id: "theme.openapi.securitySchemes.scheme",
|
|
40
|
+
message: "scheme:",
|
|
41
|
+
});
|
|
42
|
+
case "bearerFormat":
|
|
43
|
+
return translate({
|
|
44
|
+
id: "theme.openapi.securitySchemes.bearerFormat",
|
|
45
|
+
message: "bearerFormat:",
|
|
46
|
+
});
|
|
47
|
+
case "openIdConnectUrl":
|
|
48
|
+
return translate({
|
|
49
|
+
id: "theme.openapi.securitySchemes.openIdConnectUrl",
|
|
50
|
+
message: "openIdConnectUrl:",
|
|
51
|
+
});
|
|
52
|
+
default:
|
|
53
|
+
return `${k}:`;
|
|
54
|
+
}
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
const renderRest = (rest: Record<string, any>) =>
|
|
48
|
-
Object.keys(rest).map((k) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{typeof rest[k] === "object"
|
|
57
|
-
? JSON.stringify(rest[k], null, 2)
|
|
58
|
-
: String(rest[k])}
|
|
59
|
-
</span>
|
|
60
|
-
);
|
|
61
|
-
});
|
|
58
|
+
Object.keys(rest).map((k) => (
|
|
59
|
+
<span key={k}>
|
|
60
|
+
<strong>{renderRestLabel(k)} </strong>
|
|
61
|
+
{typeof rest[k] === "object"
|
|
62
|
+
? JSON.stringify(rest[k], null, 2)
|
|
63
|
+
: String(rest[k])}
|
|
64
|
+
</span>
|
|
65
|
+
));
|
|
62
66
|
return (
|
|
63
67
|
<details className="openapi-security__details" open={false}>
|
|
64
68
|
<summary className="openapi-security__summary-container">
|
|
65
69
|
<h4 className="openapi-security__summary-header">
|
|
66
|
-
|
|
70
|
+
{translate({
|
|
71
|
+
id: "theme.openapi.securitySchemes.authorization",
|
|
72
|
+
message: "Authorization:",
|
|
73
|
+
})}{" "}
|
|
74
|
+
{selectedAuth[0].name ?? selectedAuth[0].type}
|
|
67
75
|
</h4>
|
|
68
76
|
</summary>
|
|
69
77
|
{selectedAuth.map((auth: any) => {
|
|
@@ -87,7 +95,7 @@ function SecuritySchemes(props: any) {
|
|
|
87
95
|
<span>
|
|
88
96
|
<strong>
|
|
89
97
|
{translate({
|
|
90
|
-
id:
|
|
98
|
+
id: "theme.openapi.securitySchemes.name",
|
|
91
99
|
message: "name:",
|
|
92
100
|
})}
|
|
93
101
|
</strong>{" "}
|
|
@@ -96,7 +104,7 @@ function SecuritySchemes(props: any) {
|
|
|
96
104
|
<span>
|
|
97
105
|
<strong>
|
|
98
106
|
{translate({
|
|
99
|
-
id:
|
|
107
|
+
id: "theme.openapi.securitySchemes.type",
|
|
100
108
|
message: "type:",
|
|
101
109
|
})}
|
|
102
110
|
</strong>{" "}
|
|
@@ -106,7 +114,7 @@ function SecuritySchemes(props: any) {
|
|
|
106
114
|
<span>
|
|
107
115
|
<strong>
|
|
108
116
|
{translate({
|
|
109
|
-
id:
|
|
117
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
110
118
|
message: "scopes:",
|
|
111
119
|
})}
|
|
112
120
|
</strong>{" "}
|
|
@@ -134,7 +142,7 @@ function SecuritySchemes(props: any) {
|
|
|
134
142
|
<span>
|
|
135
143
|
<strong>
|
|
136
144
|
{translate({
|
|
137
|
-
id:
|
|
145
|
+
id: "theme.openapi.securitySchemes.name",
|
|
138
146
|
message: "name:",
|
|
139
147
|
})}
|
|
140
148
|
</strong>{" "}
|
|
@@ -143,7 +151,7 @@ function SecuritySchemes(props: any) {
|
|
|
143
151
|
<span>
|
|
144
152
|
<strong>
|
|
145
153
|
{translate({
|
|
146
|
-
id:
|
|
154
|
+
id: "theme.openapi.securitySchemes.type",
|
|
147
155
|
message: "type:",
|
|
148
156
|
})}
|
|
149
157
|
</strong>{" "}
|
|
@@ -153,7 +161,7 @@ function SecuritySchemes(props: any) {
|
|
|
153
161
|
<span>
|
|
154
162
|
<strong>
|
|
155
163
|
{translate({
|
|
156
|
-
id:
|
|
164
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
157
165
|
message: "scopes:",
|
|
158
166
|
})}
|
|
159
167
|
</strong>{" "}
|
|
@@ -179,7 +187,7 @@ function SecuritySchemes(props: any) {
|
|
|
179
187
|
<span>
|
|
180
188
|
<strong>
|
|
181
189
|
{translate({
|
|
182
|
-
id:
|
|
190
|
+
id: "theme.openapi.securitySchemes.name",
|
|
183
191
|
message: "name:",
|
|
184
192
|
})}
|
|
185
193
|
</strong>{" "}
|
|
@@ -188,7 +196,7 @@ function SecuritySchemes(props: any) {
|
|
|
188
196
|
<span>
|
|
189
197
|
<strong>
|
|
190
198
|
{translate({
|
|
191
|
-
id:
|
|
199
|
+
id: "theme.openapi.securitySchemes.type",
|
|
192
200
|
message: "type:",
|
|
193
201
|
})}
|
|
194
202
|
</strong>{" "}
|
|
@@ -197,7 +205,7 @@ function SecuritySchemes(props: any) {
|
|
|
197
205
|
<span>
|
|
198
206
|
<strong>
|
|
199
207
|
{translate({
|
|
200
|
-
id:
|
|
208
|
+
id: "theme.openapi.securitySchemes.in",
|
|
201
209
|
message: "in:",
|
|
202
210
|
})}
|
|
203
211
|
</strong>{" "}
|
|
@@ -222,7 +230,7 @@ function SecuritySchemes(props: any) {
|
|
|
222
230
|
<span>
|
|
223
231
|
<strong>
|
|
224
232
|
{translate({
|
|
225
|
-
id:
|
|
233
|
+
id: "theme.openapi.securitySchemes.name",
|
|
226
234
|
message: "name:",
|
|
227
235
|
})}
|
|
228
236
|
</strong>{" "}
|
|
@@ -231,7 +239,7 @@ function SecuritySchemes(props: any) {
|
|
|
231
239
|
<span>
|
|
232
240
|
<strong>
|
|
233
241
|
{translate({
|
|
234
|
-
id:
|
|
242
|
+
id: "theme.openapi.securitySchemes.type",
|
|
235
243
|
message: "type:",
|
|
236
244
|
})}
|
|
237
245
|
</strong>{" "}
|
|
@@ -241,7 +249,7 @@ function SecuritySchemes(props: any) {
|
|
|
241
249
|
<span>
|
|
242
250
|
<strong>
|
|
243
251
|
{translate({
|
|
244
|
-
id:
|
|
252
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
245
253
|
message: "scopes:",
|
|
246
254
|
})}
|
|
247
255
|
</strong>{" "}
|
|
@@ -270,7 +278,7 @@ function SecuritySchemes(props: any) {
|
|
|
270
278
|
<span>
|
|
271
279
|
<strong>
|
|
272
280
|
{translate({
|
|
273
|
-
id:
|
|
281
|
+
id: "theme.openapi.securitySchemes.name",
|
|
274
282
|
message: "name:",
|
|
275
283
|
})}
|
|
276
284
|
</strong>{" "}
|
|
@@ -279,7 +287,7 @@ function SecuritySchemes(props: any) {
|
|
|
279
287
|
<span>
|
|
280
288
|
<strong>
|
|
281
289
|
{translate({
|
|
282
|
-
id:
|
|
290
|
+
id: "theme.openapi.securitySchemes.type",
|
|
283
291
|
message: "type:",
|
|
284
292
|
})}
|
|
285
293
|
</strong>{" "}
|
|
@@ -289,7 +297,7 @@ function SecuritySchemes(props: any) {
|
|
|
289
297
|
<span>
|
|
290
298
|
<strong>
|
|
291
299
|
{translate({
|
|
292
|
-
id:
|
|
300
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
293
301
|
message: "scopes:",
|
|
294
302
|
})}
|
|
295
303
|
</strong>{" "}
|
|
@@ -304,7 +312,7 @@ function SecuritySchemes(props: any) {
|
|
|
304
312
|
<code>
|
|
305
313
|
<strong>
|
|
306
314
|
{translate({
|
|
307
|
-
id:
|
|
315
|
+
id: "theme.openapi.securitySchemes.flows",
|
|
308
316
|
message: "flows:",
|
|
309
317
|
})}
|
|
310
318
|
</strong>{" "}
|
|
@@ -331,7 +339,7 @@ function SecuritySchemes(props: any) {
|
|
|
331
339
|
<span>
|
|
332
340
|
<strong>
|
|
333
341
|
{translate({
|
|
334
|
-
id:
|
|
342
|
+
id: "theme.openapi.securitySchemes.name",
|
|
335
343
|
message: "name:",
|
|
336
344
|
})}
|
|
337
345
|
</strong>{" "}
|
|
@@ -340,7 +348,7 @@ function SecuritySchemes(props: any) {
|
|
|
340
348
|
<span>
|
|
341
349
|
<strong>
|
|
342
350
|
{translate({
|
|
343
|
-
id:
|
|
351
|
+
id: "theme.openapi.securitySchemes.type",
|
|
344
352
|
message: "type:",
|
|
345
353
|
})}
|
|
346
354
|
</strong>{" "}
|
|
@@ -350,7 +358,7 @@ function SecuritySchemes(props: any) {
|
|
|
350
358
|
<span>
|
|
351
359
|
<strong>
|
|
352
360
|
{translate({
|
|
353
|
-
id:
|
|
361
|
+
id: "theme.openapi.securitySchemes.scopes",
|
|
354
362
|
message: "scopes:",
|
|
355
363
|
})}
|
|
356
364
|
</strong>{" "}
|
|
@@ -13,7 +13,6 @@ import FormItem from "@theme/ApiExplorer/FormItem";
|
|
|
13
13
|
import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
14
14
|
import FormTextInput from "@theme/ApiExplorer/FormTextInput";
|
|
15
15
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
16
|
-
import { OPENAPI_SERVER } from "@theme/translationIds";
|
|
17
16
|
|
|
18
17
|
import { setServer, setServerVariable } from "./slice";
|
|
19
18
|
|
|
@@ -65,7 +64,10 @@ function Server({ labelId }: ServerProps) {
|
|
|
65
64
|
return (
|
|
66
65
|
<FloatingButton
|
|
67
66
|
onClick={() => setIsEditing(true)}
|
|
68
|
-
label={translate({
|
|
67
|
+
label={translate({
|
|
68
|
+
id: "theme.openapi.server.editButton",
|
|
69
|
+
message: "Edit",
|
|
70
|
+
})}
|
|
69
71
|
>
|
|
70
72
|
<FormItem>
|
|
71
73
|
<span className="openapi-explorer__server-url" title={url}>
|
|
@@ -79,7 +81,10 @@ function Server({ labelId }: ServerProps) {
|
|
|
79
81
|
<div className="openapi-explorer__server-container">
|
|
80
82
|
<FloatingButton
|
|
81
83
|
onClick={() => setIsEditing(false)}
|
|
82
|
-
label={translate({
|
|
84
|
+
label={translate({
|
|
85
|
+
id: "theme.openapi.server.hideButton",
|
|
86
|
+
message: "Hide",
|
|
87
|
+
})}
|
|
83
88
|
>
|
|
84
89
|
<FormItem>
|
|
85
90
|
<FormSelect
|
|
@@ -13,19 +13,19 @@ import React, {
|
|
|
13
13
|
ReactElement,
|
|
14
14
|
} from "react";
|
|
15
15
|
|
|
16
|
+
import { translate } from "@docusaurus/Translate";
|
|
17
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
18
|
+
import Heading from "@theme/Heading";
|
|
19
|
+
import clsx from "clsx";
|
|
20
|
+
|
|
21
|
+
import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
|
|
16
22
|
import {
|
|
17
23
|
sanitizeTabsChildren,
|
|
18
24
|
type TabItemProps,
|
|
19
25
|
TabProps,
|
|
20
26
|
TabsProvider,
|
|
21
|
-
useScrollPositionBlocker,
|
|
22
27
|
useTabsContextValue,
|
|
23
|
-
} from "@
|
|
24
|
-
import { translate } from "@docusaurus/Translate";
|
|
25
|
-
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
26
|
-
import Heading from "@theme/Heading";
|
|
27
|
-
import { OPENAPI_TABS } from "@theme/translationIds";
|
|
28
|
-
import clsx from "clsx";
|
|
28
|
+
} from "@theme/utils/tabsUtils";
|
|
29
29
|
|
|
30
30
|
export interface TabListProps extends TabProps {
|
|
31
31
|
label: string;
|
|
@@ -39,7 +39,7 @@ function TabList({
|
|
|
39
39
|
selectValue,
|
|
40
40
|
tabValues,
|
|
41
41
|
label = translate({
|
|
42
|
-
id:
|
|
42
|
+
id: "theme.openapi.tabs.responses.label",
|
|
43
43
|
message: "Responses",
|
|
44
44
|
}),
|
|
45
45
|
id = "responses",
|
|
@@ -13,17 +13,18 @@ import React, {
|
|
|
13
13
|
ReactElement,
|
|
14
14
|
} from "react";
|
|
15
15
|
|
|
16
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
17
|
+
import clsx from "clsx";
|
|
18
|
+
import flatten from "lodash/flatten";
|
|
19
|
+
|
|
20
|
+
import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
|
|
16
21
|
import {
|
|
17
22
|
sanitizeTabsChildren,
|
|
18
23
|
type TabItemProps,
|
|
19
24
|
TabProps,
|
|
20
25
|
TabsProvider,
|
|
21
|
-
useScrollPositionBlocker,
|
|
22
26
|
useTabsContextValue,
|
|
23
|
-
} from "@
|
|
24
|
-
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
25
|
-
import clsx from "clsx";
|
|
26
|
-
import flatten from "lodash/flatten";
|
|
27
|
+
} from "@theme/utils/tabsUtils";
|
|
27
28
|
|
|
28
29
|
function TabList({
|
|
29
30
|
className,
|
|
@@ -11,7 +11,6 @@ import { translate } from "@docusaurus/Translate";
|
|
|
11
11
|
import { ExampleObject } from "@theme/ParamsItem";
|
|
12
12
|
import SchemaTabs from "@theme/SchemaTabs";
|
|
13
13
|
import TabItem from "@theme/TabItem";
|
|
14
|
-
import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
|
|
15
14
|
|
|
16
15
|
const EXAMPLE_CLASS_NAME = "openapi-example";
|
|
17
16
|
const EXAMPLES_CLASS_NAME = "openapi-examples";
|
|
@@ -58,7 +57,7 @@ const renderExample = (example: ExampleType) => {
|
|
|
58
57
|
<div className={EXAMPLE_CLASS_NAME}>
|
|
59
58
|
<strong>
|
|
60
59
|
{translate({
|
|
61
|
-
id:
|
|
60
|
+
id: "theme.openapi.schemaItem.example",
|
|
62
61
|
message: "Example:",
|
|
63
62
|
})}{" "}
|
|
64
63
|
</strong>
|
|
@@ -121,7 +120,7 @@ export const renderExamplesRecord = (
|
|
|
121
120
|
<div className={EXAMPLES_CLASS_NAME}>
|
|
122
121
|
<strong>
|
|
123
122
|
{translate({
|
|
124
|
-
id:
|
|
123
|
+
id: "theme.openapi.schemaItem.examples",
|
|
125
124
|
message: "Examples:",
|
|
126
125
|
})}
|
|
127
126
|
</strong>
|
|
@@ -153,7 +152,7 @@ const renderExampleObject = (
|
|
|
153
152
|
<p>
|
|
154
153
|
<strong>
|
|
155
154
|
{translate({
|
|
156
|
-
id:
|
|
155
|
+
id: "theme.openapi.schemaItem.description",
|
|
157
156
|
message: "Description:",
|
|
158
157
|
})}{" "}
|
|
159
158
|
</strong>
|
|
@@ -13,14 +13,6 @@ import React, {
|
|
|
13
13
|
ReactElement,
|
|
14
14
|
} from "react";
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
sanitizeTabsChildren,
|
|
18
|
-
type TabItemProps,
|
|
19
|
-
TabProps,
|
|
20
|
-
TabsProvider,
|
|
21
|
-
useScrollPositionBlocker,
|
|
22
|
-
useTabsContextValue,
|
|
23
|
-
} from "@docusaurus/theme-common/internal";
|
|
24
16
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
25
17
|
import { setAccept } from "@theme/ApiExplorer/Accept/slice";
|
|
26
18
|
import { setContentType } from "@theme/ApiExplorer/ContentType/slice";
|
|
@@ -28,6 +20,15 @@ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
|
28
20
|
import { RootState } from "@theme/ApiItem/store";
|
|
29
21
|
import clsx from "clsx";
|
|
30
22
|
|
|
23
|
+
import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
|
|
24
|
+
import {
|
|
25
|
+
sanitizeTabsChildren,
|
|
26
|
+
type TabItemProps,
|
|
27
|
+
TabProps,
|
|
28
|
+
TabsProvider,
|
|
29
|
+
useTabsContextValue,
|
|
30
|
+
} from "@theme/utils/tabsUtils";
|
|
31
|
+
|
|
31
32
|
export interface Props {
|
|
32
33
|
schemaType: any;
|
|
33
34
|
}
|
|
@@ -13,16 +13,17 @@ import React, {
|
|
|
13
13
|
ReactElement,
|
|
14
14
|
} from "react";
|
|
15
15
|
|
|
16
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
17
|
+
import clsx from "clsx";
|
|
18
|
+
|
|
19
|
+
import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
|
|
16
20
|
import {
|
|
17
21
|
sanitizeTabsChildren,
|
|
18
22
|
type TabItemProps,
|
|
19
23
|
TabProps,
|
|
20
24
|
TabsProvider,
|
|
21
|
-
useScrollPositionBlocker,
|
|
22
25
|
useTabsContextValue,
|
|
23
|
-
} from "@
|
|
24
|
-
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
25
|
-
import clsx from "clsx";
|
|
26
|
+
} from "@theme/utils/tabsUtils";
|
|
26
27
|
|
|
27
28
|
function TabList({
|
|
28
29
|
className,
|
|
@@ -12,7 +12,6 @@ import { translate } from "@docusaurus/Translate";
|
|
|
12
12
|
import Details from "@theme/Details";
|
|
13
13
|
import ParamsItem from "@theme/ParamsItem";
|
|
14
14
|
import SkeletonLoader from "@theme/SkeletonLoader";
|
|
15
|
-
import { OPENAPI_PARAMS_DETAILS } from "@theme/translationIds";
|
|
16
15
|
|
|
17
16
|
interface Props {
|
|
18
17
|
parameters: any[];
|
|
@@ -35,7 +34,7 @@ const ParamsDetailsComponent: React.FC<Props> = ({ parameters }) => {
|
|
|
35
34
|
<h3 className="openapi-markdown__details-summary-header-params">
|
|
36
35
|
{translate(
|
|
37
36
|
{
|
|
38
|
-
id:
|
|
37
|
+
id: "theme.openapi.paramsDetails.parametersTitle",
|
|
39
38
|
message: "{type} Parameters",
|
|
40
39
|
},
|
|
41
40
|
{ type: type.charAt(0).toUpperCase() + type.slice(1) }
|
|
@@ -11,7 +11,6 @@ import { translate } from "@docusaurus/Translate";
|
|
|
11
11
|
import { Example } from "@theme/Example";
|
|
12
12
|
import Markdown from "@theme/Markdown";
|
|
13
13
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
14
|
-
import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
|
|
15
14
|
import clsx from "clsx";
|
|
16
15
|
|
|
17
16
|
import { getQualifierMessage, getSchemaName } from "../../markdown/schema";
|
|
@@ -41,11 +40,11 @@ export interface Props {
|
|
|
41
40
|
const getEnumDescriptionMarkdown = (enumDescriptions?: [string, string][]) => {
|
|
42
41
|
if (enumDescriptions?.length) {
|
|
43
42
|
const enumValue = translate({
|
|
44
|
-
id:
|
|
43
|
+
id: "theme.openapi.schemaItem.enumValue",
|
|
45
44
|
message: "Enum Value",
|
|
46
45
|
});
|
|
47
46
|
const description = translate({
|
|
48
|
-
id:
|
|
47
|
+
id: "theme.openapi.schemaItem.enumDescription",
|
|
49
48
|
message: "Description",
|
|
50
49
|
});
|
|
51
50
|
return `| ${enumValue} | ${description} |
|
|
@@ -92,13 +91,19 @@ function ParamsItem({ param, ...rest }: Props) {
|
|
|
92
91
|
|
|
93
92
|
const renderSchemaRequired = guard(required, () => (
|
|
94
93
|
<span className="openapi-schema__required">
|
|
95
|
-
{translate({
|
|
94
|
+
{translate({
|
|
95
|
+
id: "theme.openapi.schemaItem.required",
|
|
96
|
+
message: "required",
|
|
97
|
+
})}
|
|
96
98
|
</span>
|
|
97
99
|
));
|
|
98
100
|
|
|
99
101
|
const renderDeprecated = guard(deprecated, () => (
|
|
100
102
|
<span className="openapi-schema__deprecated">
|
|
101
|
-
{translate({
|
|
103
|
+
{translate({
|
|
104
|
+
id: "theme.openapi.schemaItem.deprecated",
|
|
105
|
+
message: "deprecated",
|
|
106
|
+
})}
|
|
102
107
|
</span>
|
|
103
108
|
));
|
|
104
109
|
|
|
@@ -113,7 +118,7 @@ function ParamsItem({ param, ...rest }: Props) {
|
|
|
113
118
|
return undefined;
|
|
114
119
|
}
|
|
115
120
|
const label = translate({
|
|
116
|
-
id:
|
|
121
|
+
id: "theme.openapi.schemaItem.constantValue",
|
|
117
122
|
message: "Constant value:",
|
|
118
123
|
});
|
|
119
124
|
return (
|
|
@@ -152,7 +157,7 @@ function ParamsItem({ param, ...rest }: Props) {
|
|
|
152
157
|
<div>
|
|
153
158
|
<strong>
|
|
154
159
|
{translate({
|
|
155
|
-
id:
|
|
160
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
156
161
|
message: "Default value:",
|
|
157
162
|
})}{" "}
|
|
158
163
|
</strong>
|
|
@@ -166,7 +171,7 @@ function ParamsItem({ param, ...rest }: Props) {
|
|
|
166
171
|
<div>
|
|
167
172
|
<strong>
|
|
168
173
|
{translate({
|
|
169
|
-
id:
|
|
174
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
170
175
|
message: "Default value:",
|
|
171
176
|
})}{" "}
|
|
172
177
|
</strong>
|
|
@@ -22,7 +22,6 @@ import SchemaExpansionControl from "@theme/SchemaExpansion";
|
|
|
22
22
|
import SchemaTabs from "@theme/SchemaTabs";
|
|
23
23
|
import SkeletonLoader from "@theme/SkeletonLoader";
|
|
24
24
|
import TabItem from "@theme/TabItem";
|
|
25
|
-
import { OPENAPI_REQUEST, OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
|
|
26
25
|
import type { MediaTypeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
27
26
|
|
|
28
27
|
interface Props {
|
|
@@ -81,13 +80,13 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
81
80
|
<summary className="openapi-markdown__details-summary--with-control">
|
|
82
81
|
<h3 className="openapi-markdown__details-summary-header-body">
|
|
83
82
|
{translate({
|
|
84
|
-
id:
|
|
83
|
+
id: "theme.openapi.request.body.title",
|
|
85
84
|
message: title,
|
|
86
85
|
})}
|
|
87
86
|
{body.required === true && (
|
|
88
87
|
<span className="openapi-schema__required">
|
|
89
88
|
{translate({
|
|
90
|
-
id:
|
|
89
|
+
id: "theme.openapi.schemaItem.required",
|
|
91
90
|
message: "required",
|
|
92
91
|
})}
|
|
93
92
|
</span>
|
|
@@ -167,7 +166,7 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
167
166
|
<summary className="openapi-markdown__details-summary--with-control">
|
|
168
167
|
<h3 className="openapi-markdown__details-summary-header-body">
|
|
169
168
|
{translate({
|
|
170
|
-
id:
|
|
169
|
+
id: "theme.openapi.request.body.title",
|
|
171
170
|
message: title,
|
|
172
171
|
})}
|
|
173
172
|
{firstBody.type === "array" && (
|
|
@@ -176,7 +175,7 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
176
175
|
{body.required && (
|
|
177
176
|
<strong className="openapi-schema__required">
|
|
178
177
|
{translate({
|
|
179
|
-
id:
|
|
178
|
+
id: "theme.openapi.schemaItem.required",
|
|
180
179
|
message: "required",
|
|
181
180
|
})}
|
|
182
181
|
</strong>
|
|
@@ -11,7 +11,6 @@ import { translate } from "@docusaurus/Translate";
|
|
|
11
11
|
import CodeSamples from "@theme/CodeSamples";
|
|
12
12
|
import Markdown from "@theme/Markdown";
|
|
13
13
|
import TabItem from "@theme/TabItem";
|
|
14
|
-
import { OPENAPI_RESPONSE_EXAMPLES } from "@theme/translationIds";
|
|
15
14
|
import { sampleResponseFromSchema } from "docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample";
|
|
16
15
|
import format from "xml-formatter";
|
|
17
16
|
|
|
@@ -115,7 +114,7 @@ export const ResponseExample: React.FC<ResponseExampleProps> = ({
|
|
|
115
114
|
// @ts-ignore
|
|
116
115
|
<TabItem
|
|
117
116
|
label={translate({
|
|
118
|
-
id:
|
|
117
|
+
id: "theme.openapi.responseExamples.example",
|
|
119
118
|
message: "Example",
|
|
120
119
|
})}
|
|
121
120
|
value="Example"
|
|
@@ -173,7 +172,7 @@ export const ExampleFromSchema: React.FC<ExampleFromSchemaProps> = ({
|
|
|
173
172
|
// @ts-ignore
|
|
174
173
|
<TabItem
|
|
175
174
|
label={translate({
|
|
176
|
-
id:
|
|
175
|
+
id: "theme.openapi.responseExamples.autoExample",
|
|
177
176
|
message: "Example (auto)",
|
|
178
177
|
})}
|
|
179
178
|
value="Example (auto)"
|
|
@@ -192,7 +191,7 @@ export const ExampleFromSchema: React.FC<ExampleFromSchemaProps> = ({
|
|
|
192
191
|
// @ts-ignore
|
|
193
192
|
<TabItem
|
|
194
193
|
label={translate({
|
|
195
|
-
id:
|
|
194
|
+
id: "theme.openapi.responseExamples.autoExample",
|
|
196
195
|
message: "Example (auto)",
|
|
197
196
|
})}
|
|
198
197
|
value="Example (auto)"
|
|
@@ -22,7 +22,6 @@ import SchemaExpansionControl from "@theme/SchemaExpansion";
|
|
|
22
22
|
import SchemaTabs from "@theme/SchemaTabs";
|
|
23
23
|
import SkeletonLoader from "@theme/SkeletonLoader";
|
|
24
24
|
import TabItem from "@theme/TabItem";
|
|
25
|
-
import { OPENAPI_SCHEMA, OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
|
|
26
25
|
import type { MediaTypeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
27
26
|
|
|
28
27
|
interface Props {
|
|
@@ -72,7 +71,7 @@ const ResponseSchemaComponent: React.FC<Props> = ({
|
|
|
72
71
|
<TabItem key={mimeType} label={mimeType} value={mimeType}>
|
|
73
72
|
<div>
|
|
74
73
|
{translate({
|
|
75
|
-
id:
|
|
74
|
+
id: "theme.openapi.schema.noSchema",
|
|
76
75
|
message: "No schema",
|
|
77
76
|
})}
|
|
78
77
|
</div>
|
|
@@ -98,7 +97,7 @@ const ResponseSchemaComponent: React.FC<Props> = ({
|
|
|
98
97
|
{body.required === true && (
|
|
99
98
|
<span className="openapi-schema__required">
|
|
100
99
|
{translate({
|
|
101
|
-
id:
|
|
100
|
+
id: "theme.openapi.schemaItem.required",
|
|
102
101
|
message: "required",
|
|
103
102
|
})}
|
|
104
103
|
</span>
|