docusaurus-theme-openapi-docs 4.7.0 → 5.0.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/index.js +2 -0
- package/lib/markdown/schema.js +63 -9
- package/lib/theme/ApiExplorer/Accept/index.js +2 -1
- package/lib/theme/ApiExplorer/Authorization/index.js +12 -18
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.js +0 -4
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +6 -2
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +191 -38
- package/lib/theme/ApiExplorer/Body/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/index.js +86 -15
- package/lib/theme/ApiExplorer/Body/resolveSchemaWithSelections.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/slice.d.ts +136 -544
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +4 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +15 -16
- package/lib/theme/ApiExplorer/ContentType/index.js +7 -2
- package/lib/theme/ApiExplorer/EncodingSelection/slice.d.ts +17 -0
- package/lib/theme/ApiExplorer/EncodingSelection/slice.js +29 -0
- package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.d.ts +12 -0
- package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.js +39 -0
- package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -4
- package/lib/theme/ApiExplorer/FormItem/index.js +2 -26
- package/lib/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
- package/lib/theme/ApiExplorer/FormLabel/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/FormLabel/index.js +50 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +4 -1
- package/lib/theme/ApiExplorer/FormMultiSelect/index.js +97 -19
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +6 -1
- package/lib/theme/ApiExplorer/FormSelect/index.js +96 -15
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +4 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.js +71 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.js +28 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +11 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +6 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +6 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +8 -3
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/ParamOptions/index.js +55 -5
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/_Request.scss +11 -0
- package/lib/theme/ApiExplorer/Request/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/index.js +19 -5
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +3 -1
- package/lib/theme/ApiExplorer/Request/makeRequest.js +19 -3
- package/lib/theme/ApiExplorer/Response/_Response.scss +11 -0
- package/lib/theme/ApiExplorer/Response/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Response/index.js +98 -12
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +2 -2
- package/lib/theme/ApiExplorer/Server/index.d.ts +4 -1
- package/lib/theme/ApiExplorer/Server/index.js +6 -3
- package/lib/theme/ApiExplorer/Server/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +5 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +46 -5
- package/lib/theme/ApiExplorer/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/index.js +1 -0
- package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +2 -0
- package/lib/theme/ApiItem/hooks.d.ts +1 -0
- package/lib/theme/ApiItem/index.js +2 -1
- package/lib/theme/ApiItem/store.d.ts +6 -0
- package/lib/theme/ApiItem/store.js +11 -7
- package/lib/theme/ApiTabs/index.js +10 -11
- package/lib/theme/DiscriminatorTabs/index.js +10 -11
- package/lib/theme/MimeTabs/index.js +10 -11
- package/lib/theme/OperationTabs/index.js +10 -11
- package/lib/theme/ParamsDetails/index.js +2 -2
- package/lib/theme/ParamsItem/index.js +27 -0
- package/lib/theme/RequestSchema/index.d.ts +1 -1
- package/lib/theme/RequestSchema/index.js +174 -111
- package/lib/theme/ResponseHeaders/index.js +0 -1
- package/lib/theme/ResponseSchema/index.d.ts +1 -1
- package/lib/theme/Schema/index.d.ts +1 -1
- package/lib/theme/Schema/index.js +91 -23
- package/lib/theme/SchemaItem/index.js +6 -1
- package/lib/theme/SchemaTabs/index.d.ts +1 -1
- package/lib/theme/SchemaTabs/index.js +31 -12
- package/lib/theme/StatusCodes/index.d.ts +1 -1
- package/lib/theme/styles.scss +1 -0
- package/lib/theme/translationIds.d.ts +3 -0
- package/lib/theme/translationIds.js +3 -0
- package/package.json +9 -8
- package/src/index.ts +2 -0
- package/src/markdown/schema.ts +69 -13
- package/src/theme/ApiExplorer/Accept/index.tsx +2 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +27 -33
- package/src/theme/ApiExplorer/Authorization/slice.ts +1 -1
- package/src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx +2 -5
- package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +119 -39
- package/src/theme/ApiExplorer/Body/index.tsx +88 -21
- package/src/theme/ApiExplorer/Body/resolveSchemaWithSelections.ts +1 -1
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +9 -1
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +19 -19
- package/src/theme/ApiExplorer/ContentType/index.tsx +7 -4
- package/src/theme/ApiExplorer/EncodingSelection/slice.ts +31 -0
- package/src/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.ts +43 -0
- package/src/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
- package/src/theme/ApiExplorer/FormItem/index.tsx +2 -17
- package/src/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
- package/src/theme/ApiExplorer/FormLabel/index.tsx +43 -0
- package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +40 -20
- package/src/theme/ApiExplorer/FormSelect/index.tsx +41 -15
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +15 -1
- package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +21 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +13 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +14 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +14 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +16 -3
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +97 -11
- package/src/theme/ApiExplorer/ParamOptions/slice.ts +1 -1
- package/src/theme/ApiExplorer/Request/_Request.scss +11 -0
- package/src/theme/ApiExplorer/Request/index.tsx +22 -10
- package/src/theme/ApiExplorer/Request/makeRequest.ts +19 -3
- package/src/theme/ApiExplorer/Response/_Response.scss +11 -0
- package/src/theme/ApiExplorer/Response/index.tsx +37 -17
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +2 -3
- package/src/theme/ApiExplorer/Server/index.tsx +10 -3
- package/src/theme/ApiExplorer/Server/slice.ts +1 -1
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +53 -6
- package/src/theme/ApiExplorer/index.tsx +2 -1
- package/src/theme/ApiItem/index.tsx +3 -2
- package/src/theme/ApiItem/store.ts +2 -0
- package/src/theme/ApiTabs/index.tsx +14 -19
- package/src/theme/DiscriminatorTabs/index.tsx +14 -19
- package/src/theme/MimeTabs/index.tsx +15 -19
- package/src/theme/OperationTabs/index.tsx +14 -19
- package/src/theme/ParamsDetails/index.tsx +2 -3
- package/src/theme/ParamsItem/index.tsx +25 -0
- package/src/theme/RequestSchema/index.tsx +144 -87
- package/src/theme/ResponseHeaders/index.tsx +1 -2
- package/src/theme/ResponseSchema/index.tsx +1 -1
- package/src/theme/Schema/index.tsx +112 -27
- package/src/theme/SchemaItem/index.tsx +6 -1
- package/src/theme/SchemaTabs/index.tsx +42 -21
- package/src/theme/StatusCodes/index.tsx +1 -1
- package/src/theme/styles.scss +1 -0
- package/src/theme/translationIds.ts +3 -0
- package/src/theme-classic.d.ts +25 -1
- package/src/types.d.ts +15 -52
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -214,21 +214,20 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
214
214
|
return react_1.default.createElement(
|
|
215
215
|
"div",
|
|
216
216
|
{ className: "margin-top--md" },
|
|
217
|
-
childTabs
|
|
218
|
-
(0, react_1.cloneElement)(tabItem, {
|
|
219
|
-
key: i,
|
|
220
|
-
hidden: tabItem.props.value !== selectedValue,
|
|
221
|
-
})
|
|
222
|
-
)
|
|
217
|
+
childTabs
|
|
223
218
|
);
|
|
224
219
|
}
|
|
225
220
|
function TabsComponent(props) {
|
|
226
|
-
const tabs = (0, internal_1.
|
|
221
|
+
const tabs = (0, internal_1.useTabsContextValue)(props);
|
|
227
222
|
return react_1.default.createElement(
|
|
228
|
-
|
|
229
|
-
{
|
|
230
|
-
react_1.default.createElement(
|
|
231
|
-
|
|
223
|
+
internal_1.TabsProvider,
|
|
224
|
+
{ value: tabs },
|
|
225
|
+
react_1.default.createElement(
|
|
226
|
+
"div",
|
|
227
|
+
{ className: "tabs-container" },
|
|
228
|
+
react_1.default.createElement(TabList, { ...props, ...tabs }),
|
|
229
|
+
react_1.default.createElement(TabContent, { ...props, ...tabs })
|
|
230
|
+
)
|
|
232
231
|
);
|
|
233
232
|
}
|
|
234
233
|
function OperationTabs(props) {
|
|
@@ -12,12 +12,12 @@ var __importDefault =
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
|
-
const Translate_1 = require("@docusaurus/Translate");
|
|
16
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
17
15
|
const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
16
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
18
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
19
18
|
const ParamsItem_1 = __importDefault(require("@theme/ParamsItem"));
|
|
20
19
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
20
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
21
21
|
const ParamsDetailsComponent = ({ parameters }) => {
|
|
22
22
|
const types = ["path", "query", "header", "cookie"];
|
|
23
23
|
return react_1.default.createElement(
|
|
@@ -88,11 +88,37 @@ function ParamsItem({ param, ...rest }) {
|
|
|
88
88
|
})
|
|
89
89
|
)
|
|
90
90
|
);
|
|
91
|
+
const constValue = schema?.const;
|
|
91
92
|
const renderQualifier = (0, utils_1.guard)(
|
|
92
93
|
(0, schema_1.getQualifierMessage)(schema),
|
|
93
94
|
(qualifier) =>
|
|
94
95
|
react_1.default.createElement(Markdown_1.default, null, qualifier)
|
|
95
96
|
);
|
|
97
|
+
function renderConstValue() {
|
|
98
|
+
if (constValue === undefined) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const label = (0, Translate_1.translate)({
|
|
102
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.CONSTANT_VALUE,
|
|
103
|
+
message: "Constant value:",
|
|
104
|
+
});
|
|
105
|
+
return react_1.default.createElement(
|
|
106
|
+
"div",
|
|
107
|
+
null,
|
|
108
|
+
react_1.default.createElement("strong", null, label, " "),
|
|
109
|
+
react_1.default.createElement(
|
|
110
|
+
"span",
|
|
111
|
+
null,
|
|
112
|
+
react_1.default.createElement(
|
|
113
|
+
"code",
|
|
114
|
+
null,
|
|
115
|
+
typeof constValue === "string"
|
|
116
|
+
? constValue
|
|
117
|
+
: JSON.stringify(constValue)
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
96
122
|
const renderDescription = (0, utils_1.guard)(description, (description) =>
|
|
97
123
|
react_1.default.createElement(Markdown_1.default, null, description)
|
|
98
124
|
);
|
|
@@ -177,6 +203,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
177
203
|
renderDeprecated
|
|
178
204
|
),
|
|
179
205
|
renderQualifier,
|
|
206
|
+
renderConstValue(),
|
|
180
207
|
renderDescription,
|
|
181
208
|
renderEnumDescriptions,
|
|
182
209
|
renderDefaultValue(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { MediaTypeObject } from "docusaurus-plugin-openapi-docs/
|
|
2
|
+
import type { MediaTypeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
3
3
|
interface Props {
|
|
4
4
|
style?: React.CSSProperties;
|
|
5
5
|
title: string;
|
|
@@ -12,15 +12,17 @@ var __importDefault =
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
|
-
const Translate_1 = require("@docusaurus/Translate");
|
|
16
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
17
15
|
const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
16
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
18
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
19
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
20
19
|
const MimeTabs_1 = __importDefault(require("@theme/MimeTabs")); // Assume these components exist
|
|
20
|
+
const ResponseExamples_1 = require("@theme/ResponseExamples");
|
|
21
21
|
const Schema_1 = __importDefault(require("@theme/Schema"));
|
|
22
|
+
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
22
23
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
23
24
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
25
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
24
26
|
const RequestSchemaComponent = ({ title, body, style }) => {
|
|
25
27
|
if (
|
|
26
28
|
body === undefined ||
|
|
@@ -36,7 +38,10 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
36
38
|
MimeTabs_1.default,
|
|
37
39
|
{ className: "openapi-tabs__mime", schemaType: "request", lazy: true },
|
|
38
40
|
mimeTypes.map((mimeType) => {
|
|
39
|
-
const
|
|
41
|
+
const mediaTypeObject = body.content[mimeType];
|
|
42
|
+
const firstBody = mediaTypeObject?.schema;
|
|
43
|
+
const requestExamples = mediaTypeObject?.examples;
|
|
44
|
+
const requestExample = mediaTypeObject?.example;
|
|
40
45
|
if (
|
|
41
46
|
firstBody === undefined ||
|
|
42
47
|
(firstBody.properties &&
|
|
@@ -50,68 +55,96 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
50
55
|
TabItem_1.default,
|
|
51
56
|
{ key: mimeType, label: mimeType, value: mimeType },
|
|
52
57
|
react_1.default.createElement(
|
|
53
|
-
|
|
54
|
-
{
|
|
58
|
+
SchemaTabs_1.default,
|
|
59
|
+
{ className: "openapi-tabs__schema" },
|
|
55
60
|
react_1.default.createElement(
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
react_1.default.createElement(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
(0, Translate_1.translate)({
|
|
75
|
-
id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
|
|
76
|
-
message: title,
|
|
77
|
-
}),
|
|
78
|
-
body.required === true &&
|
|
61
|
+
TabItem_1.default,
|
|
62
|
+
{ key: title, label: title, value: title },
|
|
63
|
+
react_1.default.createElement(
|
|
64
|
+
"div",
|
|
65
|
+
{ style: { marginTop: "1rem" } },
|
|
66
|
+
react_1.default.createElement(
|
|
67
|
+
Details_1.default,
|
|
68
|
+
{
|
|
69
|
+
className: "openapi-markdown__details mime",
|
|
70
|
+
"data-collapsed": false,
|
|
71
|
+
open: true,
|
|
72
|
+
style: style,
|
|
73
|
+
summary: react_1.default.createElement(
|
|
74
|
+
react_1.default.Fragment,
|
|
75
|
+
null,
|
|
76
|
+
react_1.default.createElement(
|
|
77
|
+
"summary",
|
|
78
|
+
null,
|
|
79
79
|
react_1.default.createElement(
|
|
80
|
-
"
|
|
81
|
-
{
|
|
80
|
+
"h3",
|
|
81
|
+
{
|
|
82
|
+
className:
|
|
83
|
+
"openapi-markdown__details-summary-header-body",
|
|
84
|
+
},
|
|
82
85
|
(0, Translate_1.translate)({
|
|
83
|
-
id: translationIds_1.
|
|
84
|
-
message:
|
|
85
|
-
})
|
|
86
|
+
id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
|
|
87
|
+
message: title,
|
|
88
|
+
}),
|
|
89
|
+
body.required === true &&
|
|
90
|
+
react_1.default.createElement(
|
|
91
|
+
"span",
|
|
92
|
+
{ className: "openapi-schema__required" },
|
|
93
|
+
(0, Translate_1.translate)({
|
|
94
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM
|
|
95
|
+
.REQUIRED,
|
|
96
|
+
message: "required",
|
|
97
|
+
})
|
|
98
|
+
)
|
|
86
99
|
)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
react_1.default.createElement(
|
|
92
|
-
"div",
|
|
93
|
-
{ style: { textAlign: "left", marginLeft: "1rem" } },
|
|
94
|
-
body.description &&
|
|
100
|
+
)
|
|
101
|
+
),
|
|
102
|
+
},
|
|
95
103
|
react_1.default.createElement(
|
|
96
104
|
"div",
|
|
97
|
-
{ style: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
{ style: { textAlign: "left", marginLeft: "1rem" } },
|
|
106
|
+
body.description &&
|
|
107
|
+
react_1.default.createElement(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
style: { marginTop: "1rem", marginBottom: "1rem" },
|
|
111
|
+
},
|
|
112
|
+
react_1.default.createElement(
|
|
113
|
+
Markdown_1.default,
|
|
114
|
+
null,
|
|
115
|
+
body.description
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
),
|
|
119
|
+
react_1.default.createElement(
|
|
120
|
+
"ul",
|
|
121
|
+
{ style: { marginLeft: "1rem" } },
|
|
122
|
+
react_1.default.createElement(Schema_1.default, {
|
|
123
|
+
schema: firstBody,
|
|
124
|
+
schemaType: "request",
|
|
125
|
+
schemaPath: "requestBody",
|
|
126
|
+
})
|
|
103
127
|
)
|
|
104
|
-
|
|
105
|
-
react_1.default.createElement(
|
|
106
|
-
"ul",
|
|
107
|
-
{ style: { marginLeft: "1rem" } },
|
|
108
|
-
react_1.default.createElement(Schema_1.default, {
|
|
109
|
-
schema: firstBody,
|
|
110
|
-
schemaType: "request",
|
|
111
|
-
schemaPath: "requestBody",
|
|
112
|
-
})
|
|
128
|
+
)
|
|
113
129
|
)
|
|
114
|
-
)
|
|
130
|
+
),
|
|
131
|
+
firstBody &&
|
|
132
|
+
!requestExample &&
|
|
133
|
+
!requestExamples &&
|
|
134
|
+
(0, ResponseExamples_1.ExampleFromSchema)({
|
|
135
|
+
schema: firstBody,
|
|
136
|
+
mimeType: mimeType,
|
|
137
|
+
}),
|
|
138
|
+
requestExamples &&
|
|
139
|
+
(0, ResponseExamples_1.ResponseExamples)({
|
|
140
|
+
responseExamples: requestExamples,
|
|
141
|
+
mimeType,
|
|
142
|
+
}),
|
|
143
|
+
requestExample &&
|
|
144
|
+
(0, ResponseExamples_1.ResponseExample)({
|
|
145
|
+
responseExample: requestExample,
|
|
146
|
+
mimeType,
|
|
147
|
+
})
|
|
115
148
|
)
|
|
116
149
|
)
|
|
117
150
|
);
|
|
@@ -119,8 +152,10 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
119
152
|
);
|
|
120
153
|
}
|
|
121
154
|
const randomFirstKey = mimeTypes[0];
|
|
122
|
-
const
|
|
123
|
-
|
|
155
|
+
const mediaTypeObject = body.content[randomFirstKey];
|
|
156
|
+
const firstBody = mediaTypeObject?.schema ?? body.content[randomFirstKey];
|
|
157
|
+
const requestExamples = mediaTypeObject?.examples;
|
|
158
|
+
const requestExample = mediaTypeObject?.example;
|
|
124
159
|
if (firstBody === undefined) {
|
|
125
160
|
return null;
|
|
126
161
|
}
|
|
@@ -131,67 +166,95 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
131
166
|
TabItem_1.default,
|
|
132
167
|
{ label: randomFirstKey, value: `${randomFirstKey}-schema` },
|
|
133
168
|
react_1.default.createElement(
|
|
134
|
-
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
react_1.default.createElement(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}),
|
|
153
|
-
firstBody.type === "array" &&
|
|
154
|
-
react_1.default.createElement(
|
|
155
|
-
"span",
|
|
156
|
-
{ style: { opacity: "0.6" } },
|
|
157
|
-
" array"
|
|
158
|
-
),
|
|
159
|
-
body.required &&
|
|
169
|
+
SchemaTabs_1.default,
|
|
170
|
+
{ className: "openapi-tabs__schema" },
|
|
171
|
+
react_1.default.createElement(
|
|
172
|
+
TabItem_1.default,
|
|
173
|
+
{ key: title, label: title, value: title },
|
|
174
|
+
react_1.default.createElement(
|
|
175
|
+
Details_1.default,
|
|
176
|
+
{
|
|
177
|
+
className: "openapi-markdown__details mime",
|
|
178
|
+
"data-collapsed": false,
|
|
179
|
+
open: true,
|
|
180
|
+
style: style,
|
|
181
|
+
summary: react_1.default.createElement(
|
|
182
|
+
react_1.default.Fragment,
|
|
183
|
+
null,
|
|
184
|
+
react_1.default.createElement(
|
|
185
|
+
"summary",
|
|
186
|
+
null,
|
|
160
187
|
react_1.default.createElement(
|
|
161
|
-
"
|
|
162
|
-
{
|
|
188
|
+
"h3",
|
|
189
|
+
{
|
|
190
|
+
className:
|
|
191
|
+
"openapi-markdown__details-summary-header-body",
|
|
192
|
+
},
|
|
163
193
|
(0, Translate_1.translate)({
|
|
164
|
-
id: translationIds_1.
|
|
165
|
-
message:
|
|
166
|
-
})
|
|
194
|
+
id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
|
|
195
|
+
message: title,
|
|
196
|
+
}),
|
|
197
|
+
firstBody.type === "array" &&
|
|
198
|
+
react_1.default.createElement(
|
|
199
|
+
"span",
|
|
200
|
+
{ style: { opacity: "0.6" } },
|
|
201
|
+
" array"
|
|
202
|
+
),
|
|
203
|
+
body.required &&
|
|
204
|
+
react_1.default.createElement(
|
|
205
|
+
"strong",
|
|
206
|
+
{ className: "openapi-schema__required" },
|
|
207
|
+
(0, Translate_1.translate)({
|
|
208
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
209
|
+
message: "required",
|
|
210
|
+
})
|
|
211
|
+
)
|
|
167
212
|
)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
react_1.default.createElement(
|
|
173
|
-
"div",
|
|
174
|
-
{ style: { textAlign: "left", marginLeft: "1rem" } },
|
|
175
|
-
body.description &&
|
|
213
|
+
)
|
|
214
|
+
),
|
|
215
|
+
},
|
|
176
216
|
react_1.default.createElement(
|
|
177
217
|
"div",
|
|
178
|
-
{ style: {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
218
|
+
{ style: { textAlign: "left", marginLeft: "1rem" } },
|
|
219
|
+
body.description &&
|
|
220
|
+
react_1.default.createElement(
|
|
221
|
+
"div",
|
|
222
|
+
{ style: { marginTop: "1rem", marginBottom: "1rem" } },
|
|
223
|
+
react_1.default.createElement(
|
|
224
|
+
Markdown_1.default,
|
|
225
|
+
null,
|
|
226
|
+
body.description
|
|
227
|
+
)
|
|
228
|
+
)
|
|
229
|
+
),
|
|
230
|
+
react_1.default.createElement(
|
|
231
|
+
"ul",
|
|
232
|
+
{ style: { marginLeft: "1rem" } },
|
|
233
|
+
react_1.default.createElement(Schema_1.default, {
|
|
234
|
+
schema: firstBody,
|
|
235
|
+
schemaType: "request",
|
|
236
|
+
schemaPath: "requestBody",
|
|
237
|
+
})
|
|
184
238
|
)
|
|
239
|
+
)
|
|
185
240
|
),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
241
|
+
firstBody &&
|
|
242
|
+
!requestExample &&
|
|
243
|
+
!requestExamples &&
|
|
244
|
+
(0, ResponseExamples_1.ExampleFromSchema)({
|
|
190
245
|
schema: firstBody,
|
|
191
|
-
|
|
192
|
-
|
|
246
|
+
mimeType: randomFirstKey,
|
|
247
|
+
}),
|
|
248
|
+
requestExamples &&
|
|
249
|
+
(0, ResponseExamples_1.ResponseExamples)({
|
|
250
|
+
responseExamples: requestExamples,
|
|
251
|
+
mimeType: randomFirstKey,
|
|
252
|
+
}),
|
|
253
|
+
requestExample &&
|
|
254
|
+
(0, ResponseExamples_1.ResponseExample)({
|
|
255
|
+
responseExample: requestExample,
|
|
256
|
+
mimeType: randomFirstKey,
|
|
193
257
|
})
|
|
194
|
-
)
|
|
195
258
|
)
|
|
196
259
|
)
|
|
197
260
|
);
|
|
@@ -27,7 +27,6 @@ const ResponseHeaders = ({ responseHeaders }) => {
|
|
|
27
27
|
name: name,
|
|
28
28
|
collapsible: false,
|
|
29
29
|
schemaName: (0, schema_1.getSchemaName)(schema),
|
|
30
|
-
qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
|
|
31
30
|
schema: schema,
|
|
32
31
|
discriminator: false,
|
|
33
32
|
children: null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { MediaTypeObject } from "docusaurus-plugin-openapi-docs/
|
|
2
|
+
import type { MediaTypeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
3
3
|
interface Props {
|
|
4
4
|
style?: React.CSSProperties;
|
|
5
5
|
title: string;
|