docusaurus-theme-openapi-docs 4.7.1 → 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.
Files changed (127) hide show
  1. package/lib/index.js +2 -0
  2. package/lib/markdown/schema.js +63 -9
  3. package/lib/theme/ApiExplorer/Accept/index.js +2 -1
  4. package/lib/theme/ApiExplorer/Authorization/index.js +12 -18
  5. package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.js +0 -4
  6. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +5 -1
  7. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +190 -37
  8. package/lib/theme/ApiExplorer/Body/index.js +84 -13
  9. package/lib/theme/ApiExplorer/Body/slice.d.ts +136 -544
  10. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
  11. package/lib/theme/ApiExplorer/CodeSnippets/index.js +4 -0
  12. package/lib/theme/ApiExplorer/CodeTabs/index.js +15 -16
  13. package/lib/theme/ApiExplorer/ContentType/index.js +7 -2
  14. package/lib/theme/ApiExplorer/EncodingSelection/slice.d.ts +17 -0
  15. package/lib/theme/ApiExplorer/EncodingSelection/slice.js +29 -0
  16. package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.d.ts +12 -0
  17. package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.js +39 -0
  18. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  19. package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -4
  20. package/lib/theme/ApiExplorer/FormItem/index.js +2 -26
  21. package/lib/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  22. package/lib/theme/ApiExplorer/FormLabel/index.d.ts +9 -0
  23. package/lib/theme/ApiExplorer/FormLabel/index.js +50 -0
  24. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +4 -1
  25. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +97 -19
  26. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +6 -1
  27. package/lib/theme/ApiExplorer/FormSelect/index.js +96 -15
  28. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +4 -1
  29. package/lib/theme/ApiExplorer/FormTextInput/index.js +71 -1
  30. package/lib/theme/ApiExplorer/MethodEndpoint/index.js +28 -0
  31. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +4 -1
  32. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +11 -3
  33. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +4 -1
  34. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +4 -1
  35. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +4 -1
  36. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +6 -2
  37. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +4 -1
  38. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +6 -2
  39. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +4 -1
  40. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +8 -3
  41. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  42. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +10 -0
  43. package/lib/theme/ApiExplorer/ParamOptions/index.js +55 -5
  44. package/lib/theme/ApiExplorer/Request/_Request.scss +11 -0
  45. package/lib/theme/ApiExplorer/Request/index.js +19 -5
  46. package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +3 -1
  47. package/lib/theme/ApiExplorer/Request/makeRequest.js +19 -3
  48. package/lib/theme/ApiExplorer/Response/_Response.scss +11 -0
  49. package/lib/theme/ApiExplorer/Response/index.js +98 -12
  50. package/lib/theme/ApiExplorer/Server/index.d.ts +4 -1
  51. package/lib/theme/ApiExplorer/Server/index.js +6 -3
  52. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +4 -1
  53. package/lib/theme/ApiExplorer/buildPostmanRequest.js +46 -5
  54. package/lib/theme/ApiExplorer/index.js +1 -0
  55. package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +2 -0
  56. package/lib/theme/ApiItem/hooks.d.ts +1 -0
  57. package/lib/theme/ApiItem/index.js +2 -1
  58. package/lib/theme/ApiItem/store.d.ts +6 -0
  59. package/lib/theme/ApiItem/store.js +11 -7
  60. package/lib/theme/ApiTabs/index.js +10 -11
  61. package/lib/theme/DiscriminatorTabs/index.js +10 -11
  62. package/lib/theme/MimeTabs/index.js +10 -11
  63. package/lib/theme/OperationTabs/index.js +10 -11
  64. package/lib/theme/ParamsItem/index.js +27 -0
  65. package/lib/theme/RequestSchema/index.js +172 -109
  66. package/lib/theme/ResponseHeaders/index.js +0 -1
  67. package/lib/theme/Schema/index.d.ts +1 -1
  68. package/lib/theme/Schema/index.js +91 -23
  69. package/lib/theme/SchemaItem/index.js +6 -1
  70. package/lib/theme/SchemaTabs/index.d.ts +1 -1
  71. package/lib/theme/SchemaTabs/index.js +31 -12
  72. package/lib/theme/styles.scss +1 -0
  73. package/lib/theme/translationIds.d.ts +3 -0
  74. package/lib/theme/translationIds.js +3 -0
  75. package/package.json +9 -8
  76. package/src/index.ts +2 -0
  77. package/src/markdown/schema.ts +69 -13
  78. package/src/theme/ApiExplorer/Accept/index.tsx +2 -1
  79. package/src/theme/ApiExplorer/Authorization/index.tsx +27 -33
  80. package/src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx +0 -5
  81. package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +115 -37
  82. package/src/theme/ApiExplorer/Body/index.tsx +85 -17
  83. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +9 -1
  84. package/src/theme/ApiExplorer/CodeTabs/index.tsx +19 -19
  85. package/src/theme/ApiExplorer/ContentType/index.tsx +7 -4
  86. package/src/theme/ApiExplorer/EncodingSelection/slice.ts +31 -0
  87. package/src/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.ts +43 -0
  88. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  89. package/src/theme/ApiExplorer/FormItem/index.tsx +2 -16
  90. package/src/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  91. package/src/theme/ApiExplorer/FormLabel/index.tsx +43 -0
  92. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +40 -20
  93. package/src/theme/ApiExplorer/FormSelect/index.tsx +41 -15
  94. package/src/theme/ApiExplorer/FormTextInput/index.tsx +15 -1
  95. package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +21 -0
  96. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +13 -2
  97. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -1
  98. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +14 -2
  99. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +14 -2
  100. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +16 -3
  101. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  102. package/src/theme/ApiExplorer/ParamOptions/index.tsx +97 -11
  103. package/src/theme/ApiExplorer/Request/_Request.scss +11 -0
  104. package/src/theme/ApiExplorer/Request/index.tsx +20 -8
  105. package/src/theme/ApiExplorer/Request/makeRequest.ts +19 -3
  106. package/src/theme/ApiExplorer/Response/_Response.scss +11 -0
  107. package/src/theme/ApiExplorer/Response/index.tsx +35 -14
  108. package/src/theme/ApiExplorer/Server/index.tsx +10 -3
  109. package/src/theme/ApiExplorer/buildPostmanRequest.ts +52 -5
  110. package/src/theme/ApiExplorer/index.tsx +1 -0
  111. package/src/theme/ApiItem/index.tsx +2 -1
  112. package/src/theme/ApiItem/store.ts +2 -0
  113. package/src/theme/ApiTabs/index.tsx +14 -19
  114. package/src/theme/DiscriminatorTabs/index.tsx +14 -19
  115. package/src/theme/MimeTabs/index.tsx +15 -19
  116. package/src/theme/OperationTabs/index.tsx +14 -19
  117. package/src/theme/ParamsItem/index.tsx +25 -0
  118. package/src/theme/RequestSchema/index.tsx +141 -83
  119. package/src/theme/ResponseHeaders/index.tsx +1 -2
  120. package/src/theme/Schema/index.tsx +112 -27
  121. package/src/theme/SchemaItem/index.tsx +6 -1
  122. package/src/theme/SchemaTabs/index.tsx +42 -21
  123. package/src/theme/styles.scss +1 -0
  124. package/src/theme/translationIds.ts +3 -0
  125. package/src/theme-classic.d.ts +25 -1
  126. package/src/types.d.ts +7 -0
  127. package/tsconfig.tsbuildinfo +1 -1
@@ -89,7 +89,9 @@ async function makeRequest(
89
89
  request,
90
90
  proxy,
91
91
  _body,
92
- timeout = DEFAULT_REQUEST_TIMEOUT
92
+ timeout = DEFAULT_REQUEST_TIMEOUT,
93
+ credentials,
94
+ encoding
93
95
  ) {
94
96
  const headers = request.toJSON().header;
95
97
  let myHeaders = new Headers();
@@ -196,12 +198,25 @@ async function makeRequest(
196
198
  const members = request.body?.formdata?.members;
197
199
  if (Array.isArray(members)) {
198
200
  for (const data of members) {
201
+ const partContentType = encoding?.[data.key]?.contentType
202
+ ?.split(",")[0]
203
+ .trim();
199
204
  if (data.key && data.value.content) {
200
- myBody.append(data.key, data.value.content);
205
+ const blob = partContentType
206
+ ? new Blob([data.value.content], { type: partContentType })
207
+ : data.value.content;
208
+ myBody.append(data.key, blob);
201
209
  }
202
210
  // handle generic key-value payload
203
211
  if (data.key && typeof data.value === "string") {
204
- myBody.append(data.key, data.value);
212
+ if (partContentType) {
213
+ myBody.append(
214
+ data.key,
215
+ new Blob([data.value], { type: partContentType })
216
+ );
217
+ } else {
218
+ myBody.append(data.key, data.value);
219
+ }
205
220
  }
206
221
  }
207
222
  }
@@ -221,6 +236,7 @@ async function makeRequest(
221
236
  method: request.method,
222
237
  headers: myHeaders,
223
238
  body: myBody,
239
+ ...(credentials && { credentials }),
224
240
  };
225
241
  let finalUrl = request.url.toString();
226
242
  if (proxy) {
@@ -43,6 +43,17 @@
43
43
  }
44
44
 
45
45
  .openapi-explorer__response-clear-btn {
46
+ -webkit-appearance: none;
47
+ -moz-appearance: none;
48
+ appearance: none;
49
+ padding: 0;
50
+ cursor: pointer;
51
+ border: 0px solid transparent;
52
+ background-color: transparent;
53
+ text-transform: inherit;
54
+ font-weight: inherit;
55
+ font-size: inherit;
56
+
46
57
  &:hover {
47
58
  cursor: pointer;
48
59
  }
@@ -5,6 +5,62 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
8
64
  var __importDefault =
9
65
  (this && this.__importDefault) ||
10
66
  function (mod) {
@@ -14,7 +70,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
70
  const react_1 = __importDefault(require("react"));
15
71
  const client_1 = require("@docusaurus/plugin-content-docs/client");
16
72
  const theme_common_1 = require("@docusaurus/theme-common");
17
- const Translate_1 = require("@docusaurus/Translate");
73
+ const Translate_1 = __importStar(require("@docusaurus/Translate"));
18
74
  const useDocusaurusContext_1 = __importDefault(
19
75
  require("@docusaurus/useDocusaurusContext")
20
76
  );
@@ -96,8 +152,9 @@ function Response({ item }) {
96
152
  })
97
153
  ),
98
154
  react_1.default.createElement(
99
- "span",
155
+ "button",
100
156
  {
157
+ type: "button",
101
158
  className: "openapi-explorer__response-clear-btn",
102
159
  onClick: () => {
103
160
  dispatch((0, slice_1.clearResponse)());
@@ -157,11 +214,27 @@ function Response({ item }) {
157
214
  className:
158
215
  "openapi-explorer__response-placeholder-message",
159
216
  },
160
- (0, Translate_1.translate)({
161
- id: translationIds_1.OPENAPI_RESPONSE.PLACEHOLDER,
162
- message:
163
- "Click the <code>Send API Request</code> button above and see the response here!",
164
- })
217
+ react_1.default.createElement(
218
+ Translate_1.default,
219
+ {
220
+ id: translationIds_1.OPENAPI_RESPONSE.PLACEHOLDER,
221
+ values: {
222
+ code: react_1.default.createElement(
223
+ "code",
224
+ null,
225
+ react_1.default.createElement(
226
+ Translate_1.default,
227
+ {
228
+ id: translationIds_1.OPENAPI_REQUEST
229
+ .SEND_BUTTON,
230
+ },
231
+ "Send API Request"
232
+ )
233
+ ),
234
+ },
235
+ },
236
+ "Click the {code} button above and see the response here!"
237
+ )
165
238
  )
166
239
  )
167
240
  ),
@@ -201,11 +274,24 @@ function Response({ item }) {
201
274
  : react_1.default.createElement(
202
275
  "p",
203
276
  { className: "openapi-explorer__response-placeholder-message" },
204
- (0, Translate_1.translate)({
205
- id: translationIds_1.OPENAPI_RESPONSE.PLACEHOLDER,
206
- message:
207
- "Click the <code>Send API Request</code> button above and see the response here!",
208
- })
277
+ react_1.default.createElement(
278
+ Translate_1.default,
279
+ {
280
+ id: translationIds_1.OPENAPI_RESPONSE.PLACEHOLDER,
281
+ values: {
282
+ code: react_1.default.createElement(
283
+ "code",
284
+ null,
285
+ react_1.default.createElement(
286
+ Translate_1.default,
287
+ { id: translationIds_1.OPENAPI_REQUEST.SEND_BUTTON },
288
+ "Send API Request"
289
+ )
290
+ ),
291
+ },
292
+ },
293
+ "Click the {code} button above and see the response here!"
294
+ )
209
295
  )
210
296
  )
211
297
  );
@@ -1,3 +1,6 @@
1
1
  import React from "react";
2
- declare function Server(): React.JSX.Element | null;
2
+ interface ServerProps {
3
+ labelId?: string;
4
+ }
5
+ declare function Server({ labelId }: ServerProps): React.JSX.Element | null;
3
6
  export default Server;
@@ -80,7 +80,7 @@ const FormTextInput_1 = __importDefault(
80
80
  const hooks_1 = require("@theme/ApiItem/hooks");
81
81
  const translationIds_1 = require("@theme/translationIds");
82
82
  const slice_1 = require("./slice");
83
- function Server() {
83
+ function Server({ labelId }) {
84
84
  const [isEditing, setIsEditing] = (0, react_1.useState)(false);
85
85
  const value = (0, hooks_1.useTypedSelector)((state) => state.server.value);
86
86
  const options = (0, hooks_1.useTypedSelector)(
@@ -154,6 +154,7 @@ function Server() {
154
154
  FormItem_1.default,
155
155
  null,
156
156
  react_1.default.createElement(FormSelect_1.default, {
157
+ ariaLabelledBy: labelId,
157
158
  options: options.map((s) => s.url),
158
159
  onChange: (e) => {
159
160
  dispatch(
@@ -177,8 +178,9 @@ function Server() {
177
178
  if (value.variables?.[key].enum !== undefined) {
178
179
  return react_1.default.createElement(
179
180
  FormItem_1.default,
180
- { label: key },
181
+ null,
181
182
  react_1.default.createElement(FormSelect_1.default, {
183
+ label: key,
182
184
  options: value.variables[key].enum,
183
185
  onChange: (e) => {
184
186
  dispatch(
@@ -193,8 +195,9 @@ function Server() {
193
195
  }
194
196
  return react_1.default.createElement(
195
197
  FormItem_1.default,
196
- { label: key },
198
+ null,
197
199
  react_1.default.createElement(FormTextInput_1.default, {
200
+ label: key,
198
201
  placeholder: value.variables?.[key].default,
199
202
  onChange: (e) => {
200
203
  dispatch(
@@ -15,6 +15,9 @@ interface Options {
15
15
  accept: string;
16
16
  body: Body;
17
17
  auth: AuthState;
18
+ encoding?: Record<string, {
19
+ contentType?: string;
20
+ }>;
18
21
  }
19
- declare function buildPostmanRequest(postman: sdk.Request, { queryParams, pathParams, cookieParams, contentType, accept, headerParams, body, server, auth, }: Options): sdk.Request;
22
+ declare function buildPostmanRequest(postman: sdk.Request, { queryParams, pathParams, cookieParams, contentType, accept, headerParams, body, server, auth, encoding, }: Options): sdk.Request;
20
23
  export default buildPostmanRequest;
@@ -314,11 +314,30 @@ function tryDecodeJsonParam(value) {
314
314
  }
315
315
  }
316
316
  // TODO: this is all a bit hacky
317
- function setBody(clonedPostman, body) {
317
+ function setBody(clonedPostman, body, encoding) {
318
318
  if (clonedPostman.body === undefined) {
319
319
  return;
320
320
  }
321
321
  if (body.type === "empty") {
322
+ // When the original request has formdata and encoding is declared, keep the
323
+ // placeholder params so the code snippet reflects the selected encoding even
324
+ // before the user has uploaded a file.
325
+ if (
326
+ clonedPostman.body?.mode === "formdata" &&
327
+ encoding &&
328
+ Object.keys(encoding).length > 0
329
+ ) {
330
+ const members = clonedPostman.body.formdata?.members ?? [];
331
+ members.forEach((param) => {
332
+ const partContentType = encoding[param.key]?.contentType
333
+ ?.split(",")[0]
334
+ .trim();
335
+ if (partContentType) {
336
+ param.contentType = partContentType;
337
+ }
338
+ });
339
+ return;
340
+ }
322
341
  clonedPostman.body = undefined;
323
342
  return;
324
343
  }
@@ -354,14 +373,35 @@ function setBody(clonedPostman, body) {
354
373
  Object.entries(body.content)
355
374
  .filter((entry) => !!entry[1])
356
375
  .forEach(([key, content]) => {
376
+ const partContentType = encoding?.[key]?.contentType
377
+ ?.split(",")[0]
378
+ .trim();
357
379
  if (content.type === "file") {
358
- params.push(new sdk.FormParam({ key: key, ...content }));
380
+ params.push(
381
+ new sdk.FormParam({
382
+ key: key,
383
+ ...content,
384
+ ...(partContentType && { contentType: partContentType }),
385
+ })
386
+ );
359
387
  } else if (content.type === "file[]") {
360
388
  content.value.forEach((file) =>
361
- params.push(new sdk.FormParam({ key, value: file }))
389
+ params.push(
390
+ new sdk.FormParam({
391
+ key,
392
+ value: file,
393
+ ...(partContentType && { contentType: partContentType }),
394
+ })
395
+ )
362
396
  );
363
397
  } else {
364
- params.push(new sdk.FormParam({ key: key, value: content.value }));
398
+ params.push(
399
+ new sdk.FormParam({
400
+ key: key,
401
+ value: content.value,
402
+ ...(partContentType && { contentType: partContentType }),
403
+ })
404
+ );
365
405
  }
366
406
  });
367
407
  params.forEach((param) => {
@@ -409,6 +449,7 @@ function buildPostmanRequest(
409
449
  body,
410
450
  server,
411
451
  auth,
452
+ encoding,
412
453
  }
413
454
  ) {
414
455
  const clonedPostman = (0, cloneDeep_1.default)(postman);
@@ -521,7 +562,7 @@ function buildPostmanRequest(
521
562
  headerParams,
522
563
  otherHeaders
523
564
  );
524
- setBody(clonedPostman, body);
565
+ setBody(clonedPostman, body, encoding);
525
566
  return clonedPostman;
526
567
  }
527
568
  exports.default = buildPostmanRequest;
@@ -99,6 +99,7 @@ function ApiExplorer({ item, infoPath }) {
99
99
  postman: postman,
100
100
  codeSamples: item["x-codeSamples"] ?? [],
101
101
  maskCredentials: mask_credentials,
102
+ requestBody: item.requestBody,
102
103
  }),
103
104
  react_1.default.createElement(Request_1.default, { item: item }),
104
105
  react_1.default.createElement(Response_1.default, { item: item })
@@ -3,6 +3,7 @@ import type { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
3
3
  export declare function createPersistenceMiddleware(options: ThemeConfig["api"]): Middleware<{}, {
4
4
  accept: import("./Accept/slice").State;
5
5
  contentType: import("./ContentType/slice").State;
6
+ encodingSelection: import("./EncodingSelection/slice").State;
6
7
  response: import("./Response/slice").State;
7
8
  server: import("./Server/slice").State;
8
9
  body: import("./Body/slice").FormBody | import("./Body/slice").RawBody | import("./Body/slice").EmptyBody;
@@ -12,6 +13,7 @@ export declare function createPersistenceMiddleware(options: ThemeConfig["api"])
12
13
  }, import("redux-thunk").ThunkDispatch<{
13
14
  accept: import("./Accept/slice").State;
14
15
  contentType: import("./ContentType/slice").State;
16
+ encodingSelection: import("./EncodingSelection/slice").State;
15
17
  response: import("./Response/slice").State;
16
18
  server: import("./Server/slice").State;
17
19
  body: import("./Body/slice").FormBody | import("./Body/slice").RawBody | import("./Body/slice").EmptyBody;
@@ -3,6 +3,7 @@ import type { RootState } from "./store";
3
3
  export declare const useTypedDispatch: () => import("redux-thunk").ThunkDispatch<{
4
4
  accept: import("../ApiExplorer/Accept/slice").State;
5
5
  contentType: import("../ApiExplorer/ContentType/slice").State;
6
+ encodingSelection: import("../ApiExplorer/EncodingSelection/slice").State;
6
7
  response: import("../ApiExplorer/Response/slice").State;
7
8
  server: import("../ApiExplorer/Server/slice").State;
8
9
  body: import("../ApiExplorer/Body/slice").FormBody | import("../ApiExplorer/Body/slice").RawBody | import("../ApiExplorer/Body/slice").EmptyBody;
@@ -100,7 +100,7 @@ function ApiItem(props) {
100
100
  api?.parameters?.forEach((param) => {
101
101
  const paramType = param.in;
102
102
  const paramsArray = params[paramType];
103
- paramsArray.push(param);
103
+ paramsArray?.push(param);
104
104
  });
105
105
  const auth = (0, slice_1.createAuth)({
106
106
  security: api?.security,
@@ -134,6 +134,7 @@ function ApiItem(props) {
134
134
  params,
135
135
  auth,
136
136
  schemaSelection: { selections: {} },
137
+ encodingSelection: {},
137
138
  },
138
139
  [persistenceMiddleware]
139
140
  );
@@ -1,6 +1,7 @@
1
1
  declare const rootReducer: import("redux").Reducer<{
2
2
  accept: import("@theme/ApiExplorer/Accept/slice").State;
3
3
  contentType: import("@theme/ApiExplorer/ContentType/slice").State;
4
+ encodingSelection: import("@theme/ApiExplorer/EncodingSelection/slice").State;
4
5
  response: import("@theme/ApiExplorer/Response/slice").State;
5
6
  server: import("@theme/ApiExplorer/Server/slice").State;
6
7
  body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
@@ -10,6 +11,7 @@ declare const rootReducer: import("redux").Reducer<{
10
11
  }, import("redux").UnknownAction, Partial<{
11
12
  accept: import("@theme/ApiExplorer/Accept/slice").State | undefined;
12
13
  contentType: import("@theme/ApiExplorer/ContentType/slice").State | undefined;
14
+ encodingSelection: import("@theme/ApiExplorer/EncodingSelection/slice").State | undefined;
13
15
  response: import("@theme/ApiExplorer/Response/slice").State | undefined;
14
16
  server: import("@theme/ApiExplorer/Server/slice").State | undefined;
15
17
  body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody | undefined;
@@ -21,6 +23,7 @@ export type RootState = ReturnType<typeof rootReducer>;
21
23
  export declare const createStoreWithState: (preloadedState: RootState, middlewares: any[]) => import("@reduxjs/toolkit").EnhancedStore<{
22
24
  accept: import("@theme/ApiExplorer/Accept/slice").State;
23
25
  contentType: import("@theme/ApiExplorer/ContentType/slice").State;
26
+ encodingSelection: import("@theme/ApiExplorer/EncodingSelection/slice").State;
24
27
  response: import("@theme/ApiExplorer/Response/slice").State;
25
28
  server: import("@theme/ApiExplorer/Server/slice").State;
26
29
  body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
@@ -31,6 +34,7 @@ export declare const createStoreWithState: (preloadedState: RootState, middlewar
31
34
  dispatch: import("redux-thunk").ThunkDispatch<{
32
35
  accept: import("@theme/ApiExplorer/Accept/slice").State;
33
36
  contentType: import("@theme/ApiExplorer/ContentType/slice").State;
37
+ encodingSelection: import("@theme/ApiExplorer/EncodingSelection/slice").State;
34
38
  response: import("@theme/ApiExplorer/Response/slice").State;
35
39
  server: import("@theme/ApiExplorer/Server/slice").State;
36
40
  body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
@@ -42,6 +46,7 @@ export declare const createStoreWithState: (preloadedState: RootState, middlewar
42
46
  export declare const createStoreWithoutState: (preloadedState: {}, middlewares: any[]) => import("@reduxjs/toolkit").EnhancedStore<{
43
47
  accept: import("@theme/ApiExplorer/Accept/slice").State;
44
48
  contentType: import("@theme/ApiExplorer/ContentType/slice").State;
49
+ encodingSelection: import("@theme/ApiExplorer/EncodingSelection/slice").State;
45
50
  response: import("@theme/ApiExplorer/Response/slice").State;
46
51
  server: import("@theme/ApiExplorer/Server/slice").State;
47
52
  body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
@@ -52,6 +57,7 @@ export declare const createStoreWithoutState: (preloadedState: {}, middlewares:
52
57
  dispatch: import("redux-thunk").ThunkDispatch<{
53
58
  accept: import("@theme/ApiExplorer/Accept/slice").State;
54
59
  contentType: import("@theme/ApiExplorer/ContentType/slice").State;
60
+ encodingSelection: import("@theme/ApiExplorer/EncodingSelection/slice").State;
55
61
  response: import("@theme/ApiExplorer/Response/slice").State;
56
62
  server: import("@theme/ApiExplorer/Server/slice").State;
57
63
  body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
@@ -22,22 +22,26 @@ const slice_4 = __importDefault(
22
22
  require("@theme/ApiExplorer/ContentType/slice")
23
23
  );
24
24
  const slice_5 = __importDefault(
25
+ require("@theme/ApiExplorer/EncodingSelection/slice")
26
+ );
27
+ const slice_6 = __importDefault(
25
28
  require("@theme/ApiExplorer/ParamOptions/slice")
26
29
  );
27
- const slice_6 = __importDefault(require("@theme/ApiExplorer/Response/slice"));
28
- const slice_7 = __importDefault(
30
+ const slice_7 = __importDefault(require("@theme/ApiExplorer/Response/slice"));
31
+ const slice_8 = __importDefault(
29
32
  require("@theme/ApiExplorer/SchemaSelection/slice")
30
33
  );
31
- const slice_8 = __importDefault(require("@theme/ApiExplorer/Server/slice"));
34
+ const slice_9 = __importDefault(require("@theme/ApiExplorer/Server/slice"));
32
35
  const rootReducer = (0, toolkit_1.combineReducers)({
33
36
  accept: slice_1.default,
34
37
  contentType: slice_4.default,
35
- response: slice_6.default,
36
- server: slice_8.default,
38
+ encodingSelection: slice_5.default,
39
+ response: slice_7.default,
40
+ server: slice_9.default,
37
41
  body: slice_3.default,
38
- params: slice_5.default,
42
+ params: slice_6.default,
39
43
  auth: slice_2.default,
40
- schemaSelection: slice_7.default,
44
+ schemaSelection: slice_8.default,
41
45
  });
42
46
  const createStoreWithState = (preloadedState, middlewares) =>
43
47
  (0, toolkit_1.configureStore)({
@@ -241,21 +241,20 @@ function TabContent({ lazy, children, selectedValue }) {
241
241
  return react_1.default.createElement(
242
242
  "div",
243
243
  { className: "margin-top--md" },
244
- childTabs.map((tabItem, i) =>
245
- (0, react_1.cloneElement)(tabItem, {
246
- key: i,
247
- hidden: tabItem.props.value !== selectedValue,
248
- })
249
- )
244
+ childTabs
250
245
  );
251
246
  }
252
247
  function TabsComponent(props) {
253
- const tabs = (0, internal_1.useTabs)(props);
248
+ const tabs = (0, internal_1.useTabsContextValue)(props);
254
249
  return react_1.default.createElement(
255
- "div",
256
- { className: "openapi-tabs__container" },
257
- react_1.default.createElement(TabList, { ...props, ...tabs }),
258
- react_1.default.createElement(TabContent, { ...props, ...tabs })
250
+ internal_1.TabsProvider,
251
+ { value: tabs },
252
+ react_1.default.createElement(
253
+ "div",
254
+ { className: "openapi-tabs__container" },
255
+ react_1.default.createElement(TabList, { ...props, ...tabs }),
256
+ react_1.default.createElement(TabContent, { ...props, ...tabs })
257
+ )
259
258
  );
260
259
  }
261
260
  function ApiTabs(props) {
@@ -219,21 +219,20 @@ function TabContent({ lazy, children, selectedValue }) {
219
219
  return react_1.default.createElement(
220
220
  "div",
221
221
  { className: "margin-top--md" },
222
- childTabs.map((tabItem, i) =>
223
- (0, react_1.cloneElement)(tabItem, {
224
- key: i,
225
- hidden: tabItem.props.value !== selectedValue,
226
- })
227
- )
222
+ childTabs
228
223
  );
229
224
  }
230
225
  function TabsComponent(props) {
231
- const tabs = (0, internal_1.useTabs)(props);
226
+ const tabs = (0, internal_1.useTabsContextValue)(props);
232
227
  return react_1.default.createElement(
233
- "div",
234
- { className: "openapi-tabs__container" },
235
- react_1.default.createElement(TabList, { ...props, ...tabs }),
236
- react_1.default.createElement(TabContent, { ...props, ...tabs })
228
+ internal_1.TabsProvider,
229
+ { value: tabs },
230
+ react_1.default.createElement(
231
+ "div",
232
+ { className: "openapi-tabs__container" },
233
+ react_1.default.createElement(TabList, { ...props, ...tabs }),
234
+ react_1.default.createElement(TabContent, { ...props, ...tabs })
235
+ )
237
236
  );
238
237
  }
239
238
  function DiscriminatorTabs(props) {
@@ -252,21 +252,20 @@ function TabContent({ lazy, children, selectedValue }) {
252
252
  return react_1.default.createElement(
253
253
  "div",
254
254
  { className: "margin-top--md" },
255
- childTabs.map((tabItem, i) =>
256
- (0, react_1.cloneElement)(tabItem, {
257
- key: i,
258
- hidden: tabItem.props.value !== selectedValue,
259
- })
260
- )
255
+ childTabs
261
256
  );
262
257
  }
263
258
  function TabsComponent(props) {
264
- const tabs = (0, internal_1.useTabs)(props);
259
+ const tabs = (0, internal_1.useTabsContextValue)(props);
265
260
  return react_1.default.createElement(
266
- "div",
267
- { className: "tabs-container" },
268
- react_1.default.createElement(TabList, { ...props, ...tabs }),
269
- react_1.default.createElement(TabContent, { ...props, ...tabs })
261
+ internal_1.TabsProvider,
262
+ { value: tabs },
263
+ react_1.default.createElement(
264
+ "div",
265
+ { className: "tabs-container" },
266
+ react_1.default.createElement(TabList, { ...props, ...tabs }),
267
+ react_1.default.createElement(TabContent, { ...props, ...tabs })
268
+ )
270
269
  );
271
270
  }
272
271
  function MimeTabs(props) {
@@ -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.map((tabItem, i) =>
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.useTabs)(props);
221
+ const tabs = (0, internal_1.useTabsContextValue)(props);
227
222
  return react_1.default.createElement(
228
- "div",
229
- { className: "tabs-container" },
230
- react_1.default.createElement(TabList, { ...props, ...tabs }),
231
- react_1.default.createElement(TabContent, { ...props, ...tabs })
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) {