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
|
@@ -16,7 +16,6 @@ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
|
16
16
|
import Markdown from "@theme/Markdown";
|
|
17
17
|
import SchemaTabs from "@theme/SchemaTabs";
|
|
18
18
|
import TabItem from "@theme/TabItem";
|
|
19
|
-
import { OPENAPI_BODY, OPENAPI_REQUEST } from "@theme/translationIds";
|
|
20
19
|
import { sampleFromSchema } from "docusaurus-plugin-openapi-docs/lib/openapi/createSchemaExample";
|
|
21
20
|
import type { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
22
21
|
import format from "xml-formatter";
|
|
@@ -292,7 +291,10 @@ function Body({
|
|
|
292
291
|
<FormFileUpload
|
|
293
292
|
placeholder={
|
|
294
293
|
schema.description ||
|
|
295
|
-
translate({
|
|
294
|
+
translate({
|
|
295
|
+
id: "theme.openapi.request.body.title",
|
|
296
|
+
message: "Body",
|
|
297
|
+
})
|
|
296
298
|
}
|
|
297
299
|
onChange={(file: any) => {
|
|
298
300
|
if (file === undefined) {
|
|
@@ -322,7 +324,7 @@ function Body({
|
|
|
322
324
|
{/* @ts-ignore */}
|
|
323
325
|
<TabItem
|
|
324
326
|
label={translate({
|
|
325
|
-
id:
|
|
327
|
+
id: "theme.openapi.body.exampleFromSchema",
|
|
326
328
|
message: "Example (from schema)",
|
|
327
329
|
})}
|
|
328
330
|
value="Example (from schema)"
|
|
@@ -412,7 +414,7 @@ function Body({
|
|
|
412
414
|
{/* @ts-ignore */}
|
|
413
415
|
<TabItem
|
|
414
416
|
label={translate({
|
|
415
|
-
id:
|
|
417
|
+
id: "theme.openapi.body.exampleFromSchema",
|
|
416
418
|
message: "Example (from schema)",
|
|
417
419
|
})}
|
|
418
420
|
value="Example (from schema)"
|
|
@@ -453,7 +455,7 @@ function Body({
|
|
|
453
455
|
{/* @ts-ignore */}
|
|
454
456
|
<TabItem
|
|
455
457
|
label={translate({
|
|
456
|
-
id:
|
|
458
|
+
id: "theme.openapi.body.exampleFromSchema",
|
|
457
459
|
message: "Example (from schema)",
|
|
458
460
|
})}
|
|
459
461
|
value="Example (from schema)"
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import React, { cloneElement, ReactElement, useEffect, useRef } from "react";
|
|
9
9
|
|
|
10
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
|
|
13
|
+
import { useScrollPositionBlocker } from "@theme/utils/scrollUtils";
|
|
10
14
|
import {
|
|
11
15
|
sanitizeTabsChildren,
|
|
12
16
|
type TabItemProps,
|
|
13
17
|
type TabProps,
|
|
14
18
|
TabsProvider,
|
|
15
|
-
useScrollPositionBlocker,
|
|
16
19
|
useTabsContextValue,
|
|
17
|
-
} from "@
|
|
18
|
-
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
19
|
-
import clsx from "clsx";
|
|
20
|
-
|
|
20
|
+
} from "@theme/utils/tabsUtils";
|
|
21
21
|
import { Language } from "../CodeSnippets/code-snippets-types";
|
|
22
22
|
|
|
23
23
|
export interface Props {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
|
+
import { translate } from "@docusaurus/Translate";
|
|
10
11
|
import fileSaver from "file-saver";
|
|
11
12
|
|
|
12
13
|
const saveFile = (url: string) => {
|
|
@@ -24,7 +25,7 @@ function Export({ url, proxy }: any) {
|
|
|
24
25
|
className="dropdown dropdown--hoverable dropdown--right"
|
|
25
26
|
>
|
|
26
27
|
<button className="export-button button button--sm button--secondary">
|
|
27
|
-
Export
|
|
28
|
+
{translate({ id: "theme.openapi.export.button", message: "Export" })}
|
|
28
29
|
</button>
|
|
29
30
|
<ul className="export-dropdown dropdown__menu">
|
|
30
31
|
<li>
|
|
@@ -36,7 +37,10 @@ function Export({ url, proxy }: any) {
|
|
|
36
37
|
className="dropdown__link"
|
|
37
38
|
href={`${url}`}
|
|
38
39
|
>
|
|
39
|
-
|
|
40
|
+
{translate({
|
|
41
|
+
id: "theme.openapi.export.openapiSpec",
|
|
42
|
+
message: "OpenAPI Spec",
|
|
43
|
+
})}
|
|
40
44
|
</a>
|
|
41
45
|
</li>
|
|
42
46
|
</ul>
|
|
@@ -9,7 +9,6 @@ import React, { useState } from "react";
|
|
|
9
9
|
|
|
10
10
|
import { translate } from "@docusaurus/Translate";
|
|
11
11
|
import FloatingButton from "@theme/ApiExplorer/FloatingButton";
|
|
12
|
-
import { OPENAPI_FORM_FILE_UPLOAD } from "@theme/translationIds";
|
|
13
12
|
import MagicDropzone from "react-magic-dropzone";
|
|
14
13
|
|
|
15
14
|
type PreviewFile = { preview: string } & File;
|
|
@@ -105,7 +104,7 @@ function FormFileUpload({ placeholder, onChange }: Props) {
|
|
|
105
104
|
}}
|
|
106
105
|
>
|
|
107
106
|
{translate({
|
|
108
|
-
id:
|
|
107
|
+
id: "theme.openapi.formFileUpload.clearButton",
|
|
109
108
|
message: "Clear",
|
|
110
109
|
})}
|
|
111
110
|
</button>
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
10
|
import { translate } from "@docusaurus/Translate";
|
|
11
|
-
import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
|
|
12
11
|
|
|
13
12
|
export interface Props {
|
|
14
13
|
htmlFor?: string;
|
|
@@ -31,7 +30,7 @@ function FormLabel({ htmlFor, label, type, required }: Props) {
|
|
|
31
30
|
{required && (
|
|
32
31
|
<span className="openapi-schema__required">
|
|
33
32
|
{translate({
|
|
34
|
-
id:
|
|
33
|
+
id: "theme.openapi.schemaItem.required",
|
|
35
34
|
message: "required",
|
|
36
35
|
})}
|
|
37
36
|
</span>
|
|
@@ -11,7 +11,6 @@ import React, { useId } from "react";
|
|
|
11
11
|
import { translate } from "@docusaurus/Translate";
|
|
12
12
|
import { ErrorMessage } from "@hookform/error-message";
|
|
13
13
|
import FormLabel from "@theme/ApiExplorer/FormLabel";
|
|
14
|
-
import { OPENAPI_FORM } from "@theme/translationIds";
|
|
15
14
|
import clsx from "clsx";
|
|
16
15
|
import { useFormContext } from "react-hook-form";
|
|
17
16
|
|
|
@@ -59,7 +58,7 @@ function FormTextInput({
|
|
|
59
58
|
{...register(paramName, {
|
|
60
59
|
required: isRequired
|
|
61
60
|
? translate({
|
|
62
|
-
id:
|
|
61
|
+
id: "theme.openapi.form.fieldRequired",
|
|
63
62
|
message: "This field is required",
|
|
64
63
|
})
|
|
65
64
|
: false,
|
|
@@ -11,7 +11,6 @@ import { usePrismTheme } from "@docusaurus/theme-common";
|
|
|
11
11
|
import { translate } from "@docusaurus/Translate";
|
|
12
12
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
13
13
|
import { ErrorMessage } from "@hookform/error-message";
|
|
14
|
-
import { OPENAPI_FORM } from "@theme/translationIds";
|
|
15
14
|
import clsx from "clsx";
|
|
16
15
|
import { Controller, useFormContext } from "react-hook-form";
|
|
17
16
|
import { LiveProvider, LiveEditor, withLive } from "react-live";
|
|
@@ -89,7 +88,7 @@ function App({
|
|
|
89
88
|
required:
|
|
90
89
|
isRequired && !code
|
|
91
90
|
? translate({
|
|
92
|
-
id:
|
|
91
|
+
id: "theme.openapi.form.fieldRequired",
|
|
93
92
|
message: "This field is required",
|
|
94
93
|
})
|
|
95
94
|
: false,
|
|
@@ -15,7 +15,6 @@ import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
|
15
15
|
import FormTextInput from "@theme/ApiExplorer/FormTextInput";
|
|
16
16
|
import { Param, setParam } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
17
17
|
import { useTypedDispatch } from "@theme/ApiItem/hooks";
|
|
18
|
-
import { OPENAPI_FORM } from "@theme/translationIds";
|
|
19
18
|
import { Controller, useFormContext } from "react-hook-form";
|
|
20
19
|
|
|
21
20
|
export interface ParamProps {
|
|
@@ -138,7 +137,7 @@ export default function ParamArrayFormItem({
|
|
|
138
137
|
rules={{
|
|
139
138
|
required: param.required
|
|
140
139
|
? translate({
|
|
141
|
-
id:
|
|
140
|
+
id: "theme.openapi.form.fieldRequired",
|
|
142
141
|
message: "This field is required",
|
|
143
142
|
})
|
|
144
143
|
: false,
|
|
@@ -177,7 +176,10 @@ export default function ParamArrayFormItem({
|
|
|
177
176
|
className="openapi-explorer__thin-btn"
|
|
178
177
|
onClick={handleAddItem}
|
|
179
178
|
>
|
|
180
|
-
|
|
179
|
+
{translate({
|
|
180
|
+
id: "theme.openapi.paramArray.addItem",
|
|
181
|
+
message: "Add item",
|
|
182
|
+
})}
|
|
181
183
|
</button>
|
|
182
184
|
</>
|
|
183
185
|
)}
|
|
@@ -12,7 +12,6 @@ import { ErrorMessage } from "@hookform/error-message";
|
|
|
12
12
|
import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
13
13
|
import { Param, setParam } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
14
14
|
import { useTypedDispatch } from "@theme/ApiItem/hooks";
|
|
15
|
-
import { OPENAPI_FORM } from "@theme/translationIds";
|
|
16
15
|
import { Controller, useFormContext } from "react-hook-form";
|
|
17
16
|
|
|
18
17
|
export interface ParamProps {
|
|
@@ -60,7 +59,7 @@ export default function ParamBooleanFormItem({
|
|
|
60
59
|
rules={{
|
|
61
60
|
required: param.required
|
|
62
61
|
? translate({
|
|
63
|
-
id:
|
|
62
|
+
id: "theme.openapi.form.fieldRequired",
|
|
64
63
|
message: "This field is required",
|
|
65
64
|
})
|
|
66
65
|
: false,
|
|
@@ -13,7 +13,6 @@ import FormMultiSelect from "@theme/ApiExplorer/FormMultiSelect";
|
|
|
13
13
|
import { getSchemaEnum } from "@theme/ApiExplorer/ParamOptions";
|
|
14
14
|
import { Param, setParam } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
15
15
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
16
|
-
import { OPENAPI_FORM } from "@theme/translationIds";
|
|
17
16
|
import { Controller, useFormContext } from "react-hook-form";
|
|
18
17
|
|
|
19
18
|
export interface ParamProps {
|
|
@@ -75,7 +74,7 @@ export default function ParamMultiSelectFormItem({
|
|
|
75
74
|
rules={{
|
|
76
75
|
required: param.required
|
|
77
76
|
? translate({
|
|
78
|
-
id:
|
|
77
|
+
id: "theme.openapi.form.fieldRequired",
|
|
79
78
|
message: "This field is required",
|
|
80
79
|
})
|
|
81
80
|
: false,
|
|
@@ -13,7 +13,6 @@ import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
|
13
13
|
import { getSchemaEnum } from "@theme/ApiExplorer/ParamOptions";
|
|
14
14
|
import { Param, setParam } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
15
15
|
import { useTypedDispatch } from "@theme/ApiItem/hooks";
|
|
16
|
-
import { OPENAPI_FORM } from "@theme/translationIds";
|
|
17
16
|
import { Controller, useFormContext } from "react-hook-form";
|
|
18
17
|
|
|
19
18
|
export interface ParamProps {
|
|
@@ -58,7 +57,7 @@ export default function ParamSelectFormItem({
|
|
|
58
57
|
rules={{
|
|
59
58
|
required: param.required
|
|
60
59
|
? translate({
|
|
61
|
-
id:
|
|
60
|
+
id: "theme.openapi.form.fieldRequired",
|
|
62
61
|
message: "This field is required",
|
|
63
62
|
})
|
|
64
63
|
: false,
|
|
@@ -15,7 +15,6 @@ import ParamMultiSelectFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormI
|
|
|
15
15
|
import ParamSelectFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem";
|
|
16
16
|
import ParamTextFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem";
|
|
17
17
|
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
18
|
-
import { OPENAPI_PARAM_OPTIONS } from "@theme/translationIds";
|
|
19
18
|
|
|
20
19
|
import { Param } from "./slice";
|
|
21
20
|
|
|
@@ -207,11 +206,11 @@ function ParamOptions() {
|
|
|
207
206
|
</span>
|
|
208
207
|
{showOptional
|
|
209
208
|
? translate({
|
|
210
|
-
id:
|
|
209
|
+
id: "theme.openapi.paramOptions.hideOptional",
|
|
211
210
|
message: "Hide optional parameters",
|
|
212
211
|
})
|
|
213
212
|
: translate({
|
|
214
|
-
id:
|
|
213
|
+
id: "theme.openapi.paramOptions.showOptional",
|
|
215
214
|
message: "Show optional parameters",
|
|
216
215
|
})}
|
|
217
216
|
</button>
|
|
@@ -16,6 +16,7 @@ import Authorization from "@theme/ApiExplorer/Authorization";
|
|
|
16
16
|
import Body from "@theme/ApiExplorer/Body";
|
|
17
17
|
import buildPostmanRequest from "@theme/ApiExplorer/buildPostmanRequest";
|
|
18
18
|
import ContentType from "@theme/ApiExplorer/ContentType";
|
|
19
|
+
import { useResolvedEncoding } from "@theme/ApiExplorer/EncodingSelection/useResolvedEncoding";
|
|
19
20
|
import ParamOptions from "@theme/ApiExplorer/ParamOptions";
|
|
20
21
|
import {
|
|
21
22
|
setResponse,
|
|
@@ -25,9 +26,7 @@ import {
|
|
|
25
26
|
clearHeaders,
|
|
26
27
|
} from "@theme/ApiExplorer/Response/slice";
|
|
27
28
|
import Server from "@theme/ApiExplorer/Server";
|
|
28
|
-
import { useResolvedEncoding } from "@theme/ApiExplorer/EncodingSelection/useResolvedEncoding";
|
|
29
29
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
30
|
-
import { OPENAPI_REQUEST } from "@theme/translationIds";
|
|
31
30
|
import type { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
32
31
|
import type { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
33
32
|
import type { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
|
|
@@ -137,26 +136,26 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
137
136
|
switch (errorType) {
|
|
138
137
|
case "timeout":
|
|
139
138
|
return translate({
|
|
140
|
-
id:
|
|
139
|
+
id: "theme.openapi.request.error.timeout",
|
|
141
140
|
message:
|
|
142
141
|
"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.",
|
|
143
142
|
});
|
|
144
143
|
case "network":
|
|
145
144
|
return translate({
|
|
146
|
-
id:
|
|
145
|
+
id: "theme.openapi.request.error.network",
|
|
147
146
|
message:
|
|
148
147
|
"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.",
|
|
149
148
|
});
|
|
150
149
|
case "cors":
|
|
151
150
|
return translate({
|
|
152
|
-
id:
|
|
151
|
+
id: "theme.openapi.request.error.cors",
|
|
153
152
|
message:
|
|
154
153
|
"The request was blocked, possibly due to CORS restrictions. Ensure the server allows requests from this origin, or try using a proxy.",
|
|
155
154
|
});
|
|
156
155
|
case "unknown":
|
|
157
156
|
default:
|
|
158
157
|
return translate({
|
|
159
|
-
id:
|
|
158
|
+
id: "theme.openapi.request.error.unknown",
|
|
160
159
|
message:
|
|
161
160
|
"An unexpected error occurred while making the request. Please try again.",
|
|
162
161
|
});
|
|
@@ -167,7 +166,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
167
166
|
dispatch(
|
|
168
167
|
setResponse(
|
|
169
168
|
translate({
|
|
170
|
-
id:
|
|
169
|
+
id: "theme.openapi.request.fetchingMessage",
|
|
171
170
|
message: "Fetching...",
|
|
172
171
|
})
|
|
173
172
|
)
|
|
@@ -195,7 +194,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
195
194
|
errorMessage = getErrorMessage(e.type);
|
|
196
195
|
} else {
|
|
197
196
|
errorMessage = translate({
|
|
198
|
-
id:
|
|
197
|
+
id: "theme.openapi.request.connectionFailed",
|
|
199
198
|
message: "Connection failed",
|
|
200
199
|
});
|
|
201
200
|
}
|
|
@@ -253,7 +252,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
253
252
|
<div className="openapi-explorer__request-header-container">
|
|
254
253
|
<span className="openapi-explorer__request-title">
|
|
255
254
|
{translate({
|
|
256
|
-
id:
|
|
255
|
+
id: "theme.openapi.request.title",
|
|
257
256
|
message: "Request",
|
|
258
257
|
})}
|
|
259
258
|
</span>
|
|
@@ -264,7 +263,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
264
263
|
onClick={collapseAllDetails}
|
|
265
264
|
>
|
|
266
265
|
{translate({
|
|
267
|
-
id:
|
|
266
|
+
id: "theme.openapi.request.collapseAll",
|
|
268
267
|
message: "Collapse all",
|
|
269
268
|
})}
|
|
270
269
|
</button>
|
|
@@ -275,7 +274,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
275
274
|
onClick={expandAllDetails}
|
|
276
275
|
>
|
|
277
276
|
{translate({
|
|
278
|
-
id:
|
|
277
|
+
id: "theme.openapi.request.expandAll",
|
|
279
278
|
message: "Expand all",
|
|
280
279
|
})}
|
|
281
280
|
</button>
|
|
@@ -296,7 +295,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
296
295
|
}}
|
|
297
296
|
>
|
|
298
297
|
{translate({
|
|
299
|
-
id:
|
|
298
|
+
id: "theme.openapi.request.baseUrl.title",
|
|
300
299
|
message: "Base URL",
|
|
301
300
|
})}
|
|
302
301
|
</summary>
|
|
@@ -315,7 +314,10 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
315
314
|
setExpandAuth(!expandAuth);
|
|
316
315
|
}}
|
|
317
316
|
>
|
|
318
|
-
{translate({
|
|
317
|
+
{translate({
|
|
318
|
+
id: "theme.openapi.request.auth.title",
|
|
319
|
+
message: "Auth",
|
|
320
|
+
})}
|
|
319
321
|
</summary>
|
|
320
322
|
<Authorization />
|
|
321
323
|
</details>
|
|
@@ -335,7 +337,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
335
337
|
}}
|
|
336
338
|
>
|
|
337
339
|
{translate({
|
|
338
|
-
id:
|
|
340
|
+
id: "theme.openapi.request.parameters.title",
|
|
339
341
|
message: "Parameters",
|
|
340
342
|
})}
|
|
341
343
|
</summary>
|
|
@@ -354,12 +356,15 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
354
356
|
setExpandBody(!expandBody);
|
|
355
357
|
}}
|
|
356
358
|
>
|
|
357
|
-
{translate({
|
|
359
|
+
{translate({
|
|
360
|
+
id: "theme.openapi.request.body.title",
|
|
361
|
+
message: "Body",
|
|
362
|
+
})}
|
|
358
363
|
{requestBodyRequired && (
|
|
359
364
|
<span className="openapi-schema__required">
|
|
360
365
|
|
|
361
366
|
{translate({
|
|
362
|
-
id:
|
|
367
|
+
id: "theme.openapi.request.requiredLabel",
|
|
363
368
|
message: "required",
|
|
364
369
|
})}
|
|
365
370
|
</span>
|
|
@@ -388,7 +393,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
388
393
|
}}
|
|
389
394
|
>
|
|
390
395
|
{translate({
|
|
391
|
-
id:
|
|
396
|
+
id: "theme.openapi.request.accept.title",
|
|
392
397
|
message: "Accept",
|
|
393
398
|
})}
|
|
394
399
|
</summary>
|
|
@@ -398,7 +403,7 @@ function Request({ item }: { item: ApiItem }) {
|
|
|
398
403
|
{showRequestButton && item.method !== "event" && (
|
|
399
404
|
<button className="openapi-explorer__request-btn" type="submit">
|
|
400
405
|
{translate({
|
|
401
|
-
id:
|
|
406
|
+
id: "theme.openapi.request.sendButton",
|
|
402
407
|
message: "Send API Request",
|
|
403
408
|
})}
|
|
404
409
|
</button>
|
|
@@ -15,7 +15,6 @@ import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock";
|
|
|
15
15
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
16
16
|
import SchemaTabs from "@theme/SchemaTabs";
|
|
17
17
|
import TabItem from "@theme/TabItem";
|
|
18
|
-
import { OPENAPI_REQUEST, OPENAPI_RESPONSE } from "@theme/translationIds";
|
|
19
18
|
import clsx from "clsx";
|
|
20
19
|
import type { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
21
20
|
import type { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
|
|
@@ -134,7 +133,10 @@ function Response({ item }: { item: ApiItem }) {
|
|
|
134
133
|
<div className="openapi-explorer__response-container">
|
|
135
134
|
<div className="openapi-explorer__response-title-container">
|
|
136
135
|
<span className="openapi-explorer__response-title">
|
|
137
|
-
{translate({
|
|
136
|
+
{translate({
|
|
137
|
+
id: "theme.openapi.response.title",
|
|
138
|
+
message: "Response",
|
|
139
|
+
})}
|
|
138
140
|
</span>
|
|
139
141
|
<button
|
|
140
142
|
type="button"
|
|
@@ -145,7 +147,7 @@ function Response({ item }: { item: ApiItem }) {
|
|
|
145
147
|
dispatch(clearHeaders());
|
|
146
148
|
}}
|
|
147
149
|
>
|
|
148
|
-
{translate({ id:
|
|
150
|
+
{translate({ id: "theme.openapi.response.clear", message: "Clear" })}
|
|
149
151
|
</button>
|
|
150
152
|
</div>
|
|
151
153
|
<div
|
|
@@ -180,11 +182,11 @@ function Response({ item }: { item: ApiItem }) {
|
|
|
180
182
|
{prettyResponse || (
|
|
181
183
|
<p className="openapi-explorer__response-placeholder-message">
|
|
182
184
|
<Translate
|
|
183
|
-
id={
|
|
185
|
+
id={"theme.openapi.response.placeholder"}
|
|
184
186
|
values={{
|
|
185
187
|
code: (
|
|
186
188
|
<code>
|
|
187
|
-
<Translate id={
|
|
189
|
+
<Translate id={"theme.openapi.request.sendButton"}>
|
|
188
190
|
Send API Request
|
|
189
191
|
</Translate>
|
|
190
192
|
</code>
|
|
@@ -202,7 +204,7 @@ function Response({ item }: { item: ApiItem }) {
|
|
|
202
204
|
{/* @ts-ignore */}
|
|
203
205
|
<TabItem
|
|
204
206
|
label={translate({
|
|
205
|
-
id:
|
|
207
|
+
id: "theme.openapi.response.headersTab",
|
|
206
208
|
message: "Headers",
|
|
207
209
|
})}
|
|
208
210
|
value="headers"
|
|
@@ -228,11 +230,11 @@ function Response({ item }: { item: ApiItem }) {
|
|
|
228
230
|
) : (
|
|
229
231
|
<p className="openapi-explorer__response-placeholder-message">
|
|
230
232
|
<Translate
|
|
231
|
-
id={
|
|
233
|
+
id={"theme.openapi.response.placeholder"}
|
|
232
234
|
values={{
|
|
233
235
|
code: (
|
|
234
236
|
<code>
|
|
235
|
-
<Translate id={
|
|
237
|
+
<Translate id={"theme.openapi.request.sendButton"}>
|
|
236
238
|
Send API Request
|
|
237
239
|
</Translate>
|
|
238
240
|
</code>
|