docusaurus-theme-openapi-docs 0.0.0-1161 → 0.0.0-1177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/theme/RequestSchema/index.js +172 -109
- package/package.json +3 -3
- package/src/theme/RequestSchema/index.tsx +141 -83
|
@@ -17,7 +17,9 @@ const Translate_1 = require("@docusaurus/Translate");
|
|
|
17
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
18
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
19
19
|
const MimeTabs_1 = __importDefault(require("@theme/MimeTabs")); // Assume these components exist
|
|
20
|
+
const ResponseExamples_1 = require("@theme/ResponseExamples");
|
|
20
21
|
const Schema_1 = __importDefault(require("@theme/Schema"));
|
|
22
|
+
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
21
23
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
22
24
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
23
25
|
const translationIds_1 = require("@theme/translationIds");
|
|
@@ -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
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-1177",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/postman-collection": "^3.5.11",
|
|
39
39
|
"@types/react-modal": "^3.16.3",
|
|
40
40
|
"concurrently": "^9.2.0",
|
|
41
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
41
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-1177",
|
|
42
42
|
"docusaurus-plugin-sass": "^0.2.6",
|
|
43
43
|
"eslint-plugin-prettier": "^5.5.1"
|
|
44
44
|
},
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=14"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "83b6ecb227cd8e9681667a02fecaee40bf12733f"
|
|
86
86
|
}
|
|
@@ -12,7 +12,13 @@ import { translate } from "@docusaurus/Translate";
|
|
|
12
12
|
import Details from "@theme/Details";
|
|
13
13
|
import Markdown from "@theme/Markdown";
|
|
14
14
|
import MimeTabs from "@theme/MimeTabs"; // Assume these components exist
|
|
15
|
+
import {
|
|
16
|
+
ExampleFromSchema,
|
|
17
|
+
ResponseExample,
|
|
18
|
+
ResponseExamples,
|
|
19
|
+
} from "@theme/ResponseExamples";
|
|
15
20
|
import SchemaNode from "@theme/Schema";
|
|
21
|
+
import SchemaTabs from "@theme/SchemaTabs";
|
|
16
22
|
import SkeletonLoader from "@theme/SkeletonLoader";
|
|
17
23
|
import TabItem from "@theme/TabItem";
|
|
18
24
|
import { OPENAPI_REQUEST, OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
|
|
@@ -46,7 +52,11 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
46
52
|
return (
|
|
47
53
|
<MimeTabs className="openapi-tabs__mime" schemaType="request" lazy>
|
|
48
54
|
{mimeTypes.map((mimeType) => {
|
|
49
|
-
const
|
|
55
|
+
const mediaTypeObject = body.content![mimeType];
|
|
56
|
+
const firstBody = mediaTypeObject?.schema;
|
|
57
|
+
const requestExamples = mediaTypeObject?.examples;
|
|
58
|
+
const requestExample = mediaTypeObject?.example;
|
|
59
|
+
|
|
50
60
|
if (
|
|
51
61
|
firstBody === undefined ||
|
|
52
62
|
(firstBody.properties &&
|
|
@@ -57,49 +67,73 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
57
67
|
return (
|
|
58
68
|
// @ts-ignore
|
|
59
69
|
<TabItem key={mimeType} label={mimeType} value={mimeType}>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
})}
|
|
74
|
-
{body.required === true && (
|
|
75
|
-
<span className="openapi-schema__required">
|
|
70
|
+
<SchemaTabs className="openapi-tabs__schema">
|
|
71
|
+
{/* @ts-ignore */}
|
|
72
|
+
<TabItem key={title} label={title} value={title}>
|
|
73
|
+
<div style={{ marginTop: "1rem" }}>
|
|
74
|
+
<Details
|
|
75
|
+
className="openapi-markdown__details mime"
|
|
76
|
+
data-collapsed={false}
|
|
77
|
+
open={true}
|
|
78
|
+
style={style}
|
|
79
|
+
summary={
|
|
80
|
+
<>
|
|
81
|
+
<summary>
|
|
82
|
+
<h3 className="openapi-markdown__details-summary-header-body">
|
|
76
83
|
{translate({
|
|
77
|
-
id:
|
|
78
|
-
message:
|
|
84
|
+
id: OPENAPI_REQUEST.BODY_TITLE,
|
|
85
|
+
message: title,
|
|
79
86
|
})}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
{body.required === true && (
|
|
88
|
+
<span className="openapi-schema__required">
|
|
89
|
+
{translate({
|
|
90
|
+
id: OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
91
|
+
message: "required",
|
|
92
|
+
})}
|
|
93
|
+
</span>
|
|
94
|
+
)}
|
|
95
|
+
</h3>
|
|
96
|
+
</summary>
|
|
97
|
+
</>
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
<div style={{ textAlign: "left", marginLeft: "1rem" }}>
|
|
101
|
+
{body.description && (
|
|
102
|
+
<div
|
|
103
|
+
style={{ marginTop: "1rem", marginBottom: "1rem" }}
|
|
104
|
+
>
|
|
105
|
+
<Markdown>{body.description}</Markdown>
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
91
108
|
</div>
|
|
92
|
-
|
|
109
|
+
<ul style={{ marginLeft: "1rem" }}>
|
|
110
|
+
<SchemaNode
|
|
111
|
+
schema={firstBody}
|
|
112
|
+
schemaType="request"
|
|
113
|
+
schemaPath="requestBody"
|
|
114
|
+
/>
|
|
115
|
+
</ul>
|
|
116
|
+
</Details>
|
|
93
117
|
</div>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
118
|
+
</TabItem>
|
|
119
|
+
{firstBody &&
|
|
120
|
+
!requestExample &&
|
|
121
|
+
!requestExamples &&
|
|
122
|
+
ExampleFromSchema({
|
|
123
|
+
schema: firstBody,
|
|
124
|
+
mimeType: mimeType,
|
|
125
|
+
})}
|
|
126
|
+
{requestExamples &&
|
|
127
|
+
ResponseExamples({
|
|
128
|
+
responseExamples: requestExamples,
|
|
129
|
+
mimeType,
|
|
130
|
+
})}
|
|
131
|
+
{requestExample &&
|
|
132
|
+
ResponseExample({
|
|
133
|
+
responseExample: requestExample,
|
|
134
|
+
mimeType,
|
|
135
|
+
})}
|
|
136
|
+
</SchemaTabs>
|
|
103
137
|
</TabItem>
|
|
104
138
|
);
|
|
105
139
|
})}
|
|
@@ -108,8 +142,10 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
108
142
|
}
|
|
109
143
|
|
|
110
144
|
const randomFirstKey = mimeTypes[0];
|
|
111
|
-
const
|
|
112
|
-
|
|
145
|
+
const mediaTypeObject = body.content[randomFirstKey];
|
|
146
|
+
const firstBody = mediaTypeObject?.schema ?? body.content![randomFirstKey];
|
|
147
|
+
const requestExamples = mediaTypeObject?.examples;
|
|
148
|
+
const requestExample = mediaTypeObject?.example;
|
|
113
149
|
|
|
114
150
|
if (firstBody === undefined) {
|
|
115
151
|
return null;
|
|
@@ -119,50 +155,72 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
|
|
|
119
155
|
<MimeTabs className="openapi-tabs__mime" schemaType="request">
|
|
120
156
|
{/* @ts-ignore */}
|
|
121
157
|
<TabItem label={randomFirstKey} value={`${randomFirstKey}-schema`}>
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
})}
|
|
135
|
-
{firstBody.type === "array" && (
|
|
136
|
-
<span style={{ opacity: "0.6" }}> array</span>
|
|
137
|
-
)}
|
|
138
|
-
{body.required && (
|
|
139
|
-
<strong className="openapi-schema__required">
|
|
158
|
+
<SchemaTabs className="openapi-tabs__schema">
|
|
159
|
+
{/* @ts-ignore */}
|
|
160
|
+
<TabItem key={title} label={title} value={title}>
|
|
161
|
+
<Details
|
|
162
|
+
className="openapi-markdown__details mime"
|
|
163
|
+
data-collapsed={false}
|
|
164
|
+
open={true}
|
|
165
|
+
style={style}
|
|
166
|
+
summary={
|
|
167
|
+
<>
|
|
168
|
+
<summary>
|
|
169
|
+
<h3 className="openapi-markdown__details-summary-header-body">
|
|
140
170
|
{translate({
|
|
141
|
-
id:
|
|
142
|
-
message:
|
|
171
|
+
id: OPENAPI_REQUEST.BODY_TITLE,
|
|
172
|
+
message: title,
|
|
143
173
|
})}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
174
|
+
{firstBody.type === "array" && (
|
|
175
|
+
<span style={{ opacity: "0.6" }}> array</span>
|
|
176
|
+
)}
|
|
177
|
+
{body.required && (
|
|
178
|
+
<strong className="openapi-schema__required">
|
|
179
|
+
{translate({
|
|
180
|
+
id: OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
181
|
+
message: "required",
|
|
182
|
+
})}
|
|
183
|
+
</strong>
|
|
184
|
+
)}
|
|
185
|
+
</h3>
|
|
186
|
+
</summary>
|
|
187
|
+
</>
|
|
188
|
+
}
|
|
189
|
+
>
|
|
190
|
+
<div style={{ textAlign: "left", marginLeft: "1rem" }}>
|
|
191
|
+
{body.description && (
|
|
192
|
+
<div style={{ marginTop: "1rem", marginBottom: "1rem" }}>
|
|
193
|
+
<Markdown>{body.description}</Markdown>
|
|
194
|
+
</div>
|
|
195
|
+
)}
|
|
155
196
|
</div>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
</
|
|
165
|
-
|
|
197
|
+
<ul style={{ marginLeft: "1rem" }}>
|
|
198
|
+
<SchemaNode
|
|
199
|
+
schema={firstBody}
|
|
200
|
+
schemaType="request"
|
|
201
|
+
schemaPath="requestBody"
|
|
202
|
+
/>
|
|
203
|
+
</ul>
|
|
204
|
+
</Details>
|
|
205
|
+
</TabItem>
|
|
206
|
+
{firstBody &&
|
|
207
|
+
!requestExample &&
|
|
208
|
+
!requestExamples &&
|
|
209
|
+
ExampleFromSchema({
|
|
210
|
+
schema: firstBody,
|
|
211
|
+
mimeType: randomFirstKey,
|
|
212
|
+
})}
|
|
213
|
+
{requestExamples &&
|
|
214
|
+
ResponseExamples({
|
|
215
|
+
responseExamples: requestExamples,
|
|
216
|
+
mimeType: randomFirstKey,
|
|
217
|
+
})}
|
|
218
|
+
{requestExample &&
|
|
219
|
+
ResponseExample({
|
|
220
|
+
responseExample: requestExample,
|
|
221
|
+
mimeType: randomFirstKey,
|
|
222
|
+
})}
|
|
223
|
+
</SchemaTabs>
|
|
166
224
|
</TabItem>
|
|
167
225
|
</MimeTabs>
|
|
168
226
|
);
|