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.
Files changed (148) 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/Authorization/slice.d.ts +1 -1
  6. package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.js +0 -4
  7. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +6 -2
  8. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +191 -38
  9. package/lib/theme/ApiExplorer/Body/index.d.ts +1 -1
  10. package/lib/theme/ApiExplorer/Body/index.js +86 -15
  11. package/lib/theme/ApiExplorer/Body/resolveSchemaWithSelections.d.ts +1 -1
  12. package/lib/theme/ApiExplorer/Body/slice.d.ts +136 -544
  13. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
  14. package/lib/theme/ApiExplorer/CodeSnippets/index.js +4 -0
  15. package/lib/theme/ApiExplorer/CodeTabs/index.js +15 -16
  16. package/lib/theme/ApiExplorer/ContentType/index.js +7 -2
  17. package/lib/theme/ApiExplorer/EncodingSelection/slice.d.ts +17 -0
  18. package/lib/theme/ApiExplorer/EncodingSelection/slice.js +29 -0
  19. package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.d.ts +12 -0
  20. package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.js +39 -0
  21. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  22. package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -4
  23. package/lib/theme/ApiExplorer/FormItem/index.js +2 -26
  24. package/lib/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  25. package/lib/theme/ApiExplorer/FormLabel/index.d.ts +9 -0
  26. package/lib/theme/ApiExplorer/FormLabel/index.js +50 -0
  27. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +4 -1
  28. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +97 -19
  29. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +6 -1
  30. package/lib/theme/ApiExplorer/FormSelect/index.js +96 -15
  31. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +4 -1
  32. package/lib/theme/ApiExplorer/FormTextInput/index.js +71 -1
  33. package/lib/theme/ApiExplorer/MethodEndpoint/index.js +28 -0
  34. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +4 -1
  35. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +11 -3
  36. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +4 -1
  37. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +4 -1
  38. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +4 -1
  39. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +6 -2
  40. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +4 -1
  41. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +6 -2
  42. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +4 -1
  43. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +8 -3
  44. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  45. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +10 -0
  46. package/lib/theme/ApiExplorer/ParamOptions/index.js +55 -5
  47. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
  48. package/lib/theme/ApiExplorer/Request/_Request.scss +11 -0
  49. package/lib/theme/ApiExplorer/Request/index.d.ts +1 -1
  50. package/lib/theme/ApiExplorer/Request/index.js +19 -5
  51. package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +3 -1
  52. package/lib/theme/ApiExplorer/Request/makeRequest.js +19 -3
  53. package/lib/theme/ApiExplorer/Response/_Response.scss +11 -0
  54. package/lib/theme/ApiExplorer/Response/index.d.ts +1 -1
  55. package/lib/theme/ApiExplorer/Response/index.js +98 -12
  56. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +2 -2
  57. package/lib/theme/ApiExplorer/Server/index.d.ts +4 -1
  58. package/lib/theme/ApiExplorer/Server/index.js +6 -3
  59. package/lib/theme/ApiExplorer/Server/slice.d.ts +1 -1
  60. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +5 -2
  61. package/lib/theme/ApiExplorer/buildPostmanRequest.js +46 -5
  62. package/lib/theme/ApiExplorer/index.d.ts +1 -1
  63. package/lib/theme/ApiExplorer/index.js +1 -0
  64. package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +2 -0
  65. package/lib/theme/ApiItem/hooks.d.ts +1 -0
  66. package/lib/theme/ApiItem/index.js +2 -1
  67. package/lib/theme/ApiItem/store.d.ts +6 -0
  68. package/lib/theme/ApiItem/store.js +11 -7
  69. package/lib/theme/ApiTabs/index.js +10 -11
  70. package/lib/theme/DiscriminatorTabs/index.js +10 -11
  71. package/lib/theme/MimeTabs/index.js +10 -11
  72. package/lib/theme/OperationTabs/index.js +10 -11
  73. package/lib/theme/ParamsDetails/index.js +2 -2
  74. package/lib/theme/ParamsItem/index.js +27 -0
  75. package/lib/theme/RequestSchema/index.d.ts +1 -1
  76. package/lib/theme/RequestSchema/index.js +174 -111
  77. package/lib/theme/ResponseHeaders/index.js +0 -1
  78. package/lib/theme/ResponseSchema/index.d.ts +1 -1
  79. package/lib/theme/Schema/index.d.ts +1 -1
  80. package/lib/theme/Schema/index.js +91 -23
  81. package/lib/theme/SchemaItem/index.js +6 -1
  82. package/lib/theme/SchemaTabs/index.d.ts +1 -1
  83. package/lib/theme/SchemaTabs/index.js +31 -12
  84. package/lib/theme/StatusCodes/index.d.ts +1 -1
  85. package/lib/theme/styles.scss +1 -0
  86. package/lib/theme/translationIds.d.ts +3 -0
  87. package/lib/theme/translationIds.js +3 -0
  88. package/package.json +9 -8
  89. package/src/index.ts +2 -0
  90. package/src/markdown/schema.ts +69 -13
  91. package/src/theme/ApiExplorer/Accept/index.tsx +2 -1
  92. package/src/theme/ApiExplorer/Authorization/index.tsx +27 -33
  93. package/src/theme/ApiExplorer/Authorization/slice.ts +1 -1
  94. package/src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx +2 -5
  95. package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +119 -39
  96. package/src/theme/ApiExplorer/Body/index.tsx +88 -21
  97. package/src/theme/ApiExplorer/Body/resolveSchemaWithSelections.ts +1 -1
  98. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +9 -1
  99. package/src/theme/ApiExplorer/CodeTabs/index.tsx +19 -19
  100. package/src/theme/ApiExplorer/ContentType/index.tsx +7 -4
  101. package/src/theme/ApiExplorer/EncodingSelection/slice.ts +31 -0
  102. package/src/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.ts +43 -0
  103. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  104. package/src/theme/ApiExplorer/FormItem/index.tsx +2 -17
  105. package/src/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  106. package/src/theme/ApiExplorer/FormLabel/index.tsx +43 -0
  107. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +40 -20
  108. package/src/theme/ApiExplorer/FormSelect/index.tsx +41 -15
  109. package/src/theme/ApiExplorer/FormTextInput/index.tsx +15 -1
  110. package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +21 -0
  111. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +13 -2
  112. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -1
  113. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +14 -2
  114. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +14 -2
  115. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +16 -3
  116. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  117. package/src/theme/ApiExplorer/ParamOptions/index.tsx +97 -11
  118. package/src/theme/ApiExplorer/ParamOptions/slice.ts +1 -1
  119. package/src/theme/ApiExplorer/Request/_Request.scss +11 -0
  120. package/src/theme/ApiExplorer/Request/index.tsx +22 -10
  121. package/src/theme/ApiExplorer/Request/makeRequest.ts +19 -3
  122. package/src/theme/ApiExplorer/Response/_Response.scss +11 -0
  123. package/src/theme/ApiExplorer/Response/index.tsx +37 -17
  124. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +2 -3
  125. package/src/theme/ApiExplorer/Server/index.tsx +10 -3
  126. package/src/theme/ApiExplorer/Server/slice.ts +1 -1
  127. package/src/theme/ApiExplorer/buildPostmanRequest.ts +53 -6
  128. package/src/theme/ApiExplorer/index.tsx +2 -1
  129. package/src/theme/ApiItem/index.tsx +3 -2
  130. package/src/theme/ApiItem/store.ts +2 -0
  131. package/src/theme/ApiTabs/index.tsx +14 -19
  132. package/src/theme/DiscriminatorTabs/index.tsx +14 -19
  133. package/src/theme/MimeTabs/index.tsx +15 -19
  134. package/src/theme/OperationTabs/index.tsx +14 -19
  135. package/src/theme/ParamsDetails/index.tsx +2 -3
  136. package/src/theme/ParamsItem/index.tsx +25 -0
  137. package/src/theme/RequestSchema/index.tsx +144 -87
  138. package/src/theme/ResponseHeaders/index.tsx +1 -2
  139. package/src/theme/ResponseSchema/index.tsx +1 -1
  140. package/src/theme/Schema/index.tsx +112 -27
  141. package/src/theme/SchemaItem/index.tsx +6 -1
  142. package/src/theme/SchemaTabs/index.tsx +42 -21
  143. package/src/theme/StatusCodes/index.tsx +1 -1
  144. package/src/theme/styles.scss +1 -0
  145. package/src/theme/translationIds.ts +3 -0
  146. package/src/theme-classic.d.ts +25 -1
  147. package/src/types.d.ts +15 -52
  148. package/tsconfig.tsbuildinfo +1 -1
@@ -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) {
@@ -12,9 +68,10 @@ var __importDefault =
12
68
  };
13
69
  Object.defineProperty(exports, "__esModule", { value: true });
14
70
  // @ts-nocheck
15
- const react_1 = __importDefault(require("react"));
71
+ const react_1 = __importStar(require("react"));
16
72
  const Translate_1 = require("@docusaurus/Translate");
17
73
  const error_message_1 = require("@hookform/error-message");
74
+ const FormLabel_1 = __importDefault(require("@theme/ApiExplorer/FormLabel"));
18
75
  const translationIds_1 = require("@theme/translationIds");
19
76
  const clsx_1 = __importDefault(require("clsx"));
20
77
  const react_hook_form_1 = require("react-hook-form");
@@ -25,7 +82,11 @@ function FormTextInput({
25
82
  password,
26
83
  onChange,
27
84
  paramName,
85
+ label,
86
+ type,
87
+ required,
28
88
  }) {
89
+ const id = (0, react_1.useId)();
29
90
  placeholder = placeholder?.split("\n")[0];
30
91
  const {
31
92
  register,
@@ -35,6 +96,13 @@ function FormTextInput({
35
96
  return react_1.default.createElement(
36
97
  react_1.default.Fragment,
37
98
  null,
99
+ label &&
100
+ react_1.default.createElement(FormLabel_1.default, {
101
+ htmlFor: id,
102
+ label: label,
103
+ type: type,
104
+ required: required,
105
+ }),
38
106
  paramName
39
107
  ? react_1.default.createElement("input", {
40
108
  ...register(paramName, {
@@ -45,6 +113,7 @@ function FormTextInput({
45
113
  })
46
114
  : false,
47
115
  }),
116
+ id: label ? id : undefined,
48
117
  className: (0, clsx_1.default)("openapi-explorer__form-item-input", {
49
118
  error: showErrorMessage,
50
119
  }),
@@ -56,6 +125,7 @@ function FormTextInput({
56
125
  autoComplete: "off",
57
126
  })
58
127
  : react_1.default.createElement("input", {
128
+ id: label ? id : undefined,
59
129
  className: "openapi-explorer__form-item-input",
60
130
  type: password ? "password" : "text",
61
131
  placeholder: placeholder,
@@ -13,6 +13,9 @@ var __importDefault =
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  const react_1 = __importDefault(require("react"));
15
15
  const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
16
+ const ExecutionEnvironment_1 = __importDefault(
17
+ require("@docusaurus/ExecutionEnvironment")
18
+ );
16
19
  const hooks_1 = require("@theme/ApiItem/hooks");
17
20
  function colorForMethod(method) {
18
21
  switch (method.toLowerCase()) {
@@ -35,6 +38,31 @@ function colorForMethod(method) {
35
38
  }
36
39
  }
37
40
  function MethodEndpoint({ method, path, context }) {
41
+ // During SSR, render without Redux store access to avoid "Cannot read properties
42
+ // of null (reading 'store')" errors caused by useSelector running outside a Provider.
43
+ if (!ExecutionEnvironment_1.default.canUseDOM) {
44
+ return react_1.default.createElement(
45
+ react_1.default.Fragment,
46
+ null,
47
+ react_1.default.createElement(
48
+ "pre",
49
+ { className: "openapi__method-endpoint" },
50
+ react_1.default.createElement(
51
+ "span",
52
+ { className: "badge badge--" + colorForMethod(method) },
53
+ method === "event" ? "Webhook" : method.toUpperCase()
54
+ ),
55
+ " ",
56
+ method !== "event" &&
57
+ react_1.default.createElement(
58
+ "h2",
59
+ { className: "openapi__method-endpoint-path" },
60
+ `${path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}`
61
+ )
62
+ ),
63
+ react_1.default.createElement("div", { className: "openapi__divider" })
64
+ );
65
+ }
38
66
  let serverValue = (0, hooks_1.useTypedSelector)(
39
67
  (state) => state.server.value
40
68
  );
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamArrayFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamArrayFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -72,6 +72,7 @@ const react_1 = __importStar(require("react"));
72
72
  const Translate_1 = require("@docusaurus/Translate");
73
73
  const error_message_1 = require("@hookform/error-message");
74
74
  const toolkit_1 = require("@reduxjs/toolkit");
75
+ const FormLabel_1 = __importDefault(require("@theme/ApiExplorer/FormLabel"));
75
76
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
76
77
  const FormTextInput_1 = __importDefault(
77
78
  require("@theme/ApiExplorer/FormTextInput")
@@ -84,6 +85,7 @@ function ArrayItem({ param, onChange, initialValue }) {
84
85
  const [value, setValue] = (0, react_1.useState)(initialValue || "");
85
86
  if (param.schema?.items?.type === "boolean") {
86
87
  return react_1.default.createElement(FormSelect_1.default, {
88
+ ariaLabel: param.description || param.name,
87
89
  options: ["---", "true", "false"],
88
90
  onChange: (e) => {
89
91
  const val = e.target.value;
@@ -100,7 +102,7 @@ function ArrayItem({ param, onChange, initialValue }) {
100
102
  },
101
103
  });
102
104
  }
103
- function ParamArrayFormItem({ param }) {
105
+ function ParamArrayFormItem({ param, label, type, required }) {
104
106
  const [items, setItems] = (0, react_1.useState)([]);
105
107
  const dispatch = (0, hooks_1.useTypedDispatch)();
106
108
  const {
@@ -158,6 +160,12 @@ function ParamArrayFormItem({ param }) {
158
160
  return react_1.default.createElement(
159
161
  react_1.default.Fragment,
160
162
  null,
163
+ label &&
164
+ react_1.default.createElement(FormLabel_1.default, {
165
+ label: label,
166
+ type: type,
167
+ required: required,
168
+ }),
161
169
  react_1.default.createElement(react_hook_form_1.Controller, {
162
170
  control: control,
163
171
  rules: {
@@ -187,6 +195,7 @@ function ParamArrayFormItem({ param }) {
187
195
  {
188
196
  className: "openapi-explorer__delete-btn",
189
197
  onClick: handleDeleteItem(item),
198
+ "aria-label": "Delete",
190
199
  },
191
200
  react_1.default.createElement(
192
201
  "svg",
@@ -202,8 +211,7 @@ function ParamArrayFormItem({ param }) {
202
211
  },
203
212
  react_1.default.createElement("path", {
204
213
  d: "M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z",
205
- }),
206
- react_1.default.createElement("title", null, "Delete")
214
+ })
207
215
  )
208
216
  )
209
217
  )
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamBooleanFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamBooleanFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -20,7 +20,7 @@ const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
20
20
  const hooks_1 = require("@theme/ApiItem/hooks");
21
21
  const translationIds_1 = require("@theme/translationIds");
22
22
  const react_hook_form_1 = require("react-hook-form");
23
- function ParamBooleanFormItem({ param }) {
23
+ function ParamBooleanFormItem({ param, label, type, required }) {
24
24
  const dispatch = (0, hooks_1.useTypedDispatch)();
25
25
  const {
26
26
  control,
@@ -43,6 +43,9 @@ function ParamBooleanFormItem({ param }) {
43
43
  name: "paramBoolean",
44
44
  render: ({ field: { onChange } }) =>
45
45
  react_1.default.createElement(FormSelect_1.default, {
46
+ label: label,
47
+ type: type,
48
+ required: required,
46
49
  options: ["---", "true", "false"],
47
50
  onChange: (e) => {
48
51
  const val = e.target.value;
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamMultiSelectFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamMultiSelectFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -18,18 +18,19 @@ const error_message_1 = require("@hookform/error-message");
18
18
  const FormMultiSelect_1 = __importDefault(
19
19
  require("@theme/ApiExplorer/FormMultiSelect")
20
20
  );
21
+ const ParamOptions_1 = require("@theme/ApiExplorer/ParamOptions");
21
22
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
22
23
  const hooks_1 = require("@theme/ApiItem/hooks");
23
24
  const translationIds_1 = require("@theme/translationIds");
24
25
  const react_hook_form_1 = require("react-hook-form");
25
- function ParamMultiSelectFormItem({ param }) {
26
+ function ParamMultiSelectFormItem({ param, label, type, required }) {
26
27
  const {
27
28
  control,
28
29
  formState: { errors },
29
30
  } = (0, react_hook_form_1.useFormContext)();
30
31
  const showErrorMessage = errors?.paramMultiSelect;
31
32
  const dispatch = (0, hooks_1.useTypedDispatch)();
32
- const options = param.schema?.items?.enum ?? [];
33
+ const options = (0, ParamOptions_1.getSchemaEnum)(param.schema?.items) ?? [];
33
34
  const pathParams = (0, hooks_1.useTypedSelector)(
34
35
  (state) => state.params.path
35
36
  );
@@ -77,6 +78,9 @@ function ParamMultiSelectFormItem({ param }) {
77
78
  name: "paramMultiSelect",
78
79
  render: ({ field: { onChange } }) =>
79
80
  react_1.default.createElement(FormMultiSelect_1.default, {
81
+ label: label,
82
+ type: type,
83
+ required: required,
80
84
  options: options,
81
85
  onChange: (e) => handleChange(e, onChange),
82
86
  showErrors: !!showErrorMessage,
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamSelectFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamSelectFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -16,18 +16,19 @@ const react_1 = __importDefault(require("react"));
16
16
  const Translate_1 = require("@docusaurus/Translate");
17
17
  const error_message_1 = require("@hookform/error-message");
18
18
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
19
+ const ParamOptions_1 = require("@theme/ApiExplorer/ParamOptions");
19
20
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
20
21
  const hooks_1 = require("@theme/ApiItem/hooks");
21
22
  const translationIds_1 = require("@theme/translationIds");
22
23
  const react_hook_form_1 = require("react-hook-form");
23
- function ParamSelectFormItem({ param }) {
24
+ function ParamSelectFormItem({ param, label, type, required }) {
24
25
  const {
25
26
  control,
26
27
  formState: { errors },
27
28
  } = (0, react_hook_form_1.useFormContext)();
28
29
  const showErrorMessage = errors?.paramSelect;
29
30
  const dispatch = (0, hooks_1.useTypedDispatch)();
30
- const options = param.schema?.enum ?? [];
31
+ const options = (0, ParamOptions_1.getSchemaEnum)(param.schema) ?? [];
31
32
  return react_1.default.createElement(
32
33
  react_1.default.Fragment,
33
34
  null,
@@ -44,6 +45,9 @@ function ParamSelectFormItem({ param }) {
44
45
  name: "paramSelect",
45
46
  render: ({ field: { onChange } }) =>
46
47
  react_1.default.createElement(FormSelect_1.default, {
48
+ label: label,
49
+ type: type,
50
+ required: required,
47
51
  options: ["---", ...options],
48
52
  onChange: (e) => {
49
53
  const val = e.target.value;
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamTextFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamTextFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -18,9 +18,12 @@ const FormTextInput_1 = __importDefault(
18
18
  );
19
19
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
20
20
  const hooks_1 = require("@theme/ApiItem/hooks");
21
- function ParamTextFormItem({ param }) {
21
+ function ParamTextFormItem({ param, label, type, required }) {
22
22
  const dispatch = (0, hooks_1.useTypedDispatch)();
23
23
  return react_1.default.createElement(FormTextInput_1.default, {
24
+ label: label,
25
+ type: type,
26
+ required: required,
24
27
  isRequired: param.required,
25
28
  paramName: param.name,
26
29
  placeholder: param.description || param.name,
@@ -29,9 +32,11 @@ function ParamTextFormItem({ param }) {
29
32
  (0, slice_1.setParam)({
30
33
  ...param,
31
34
  value:
32
- param.in === "path" || param.in === "query"
35
+ param.in === "path"
33
36
  ? e.target.value.replace(/\s/g, "%20")
34
- : e.target.value,
37
+ : param.in === "query"
38
+ ? encodeURIComponent(e.target.value)
39
+ : e.target.value,
35
40
  })
36
41
  ),
37
42
  });
@@ -63,15 +63,10 @@
63
63
  margin-top: calc(var(--ifm-pre-padding) / 2);
64
64
  background-color: var(--openapi-input-background);
65
65
  border: none;
66
- outline: none;
67
66
  color: var(--ifm-pre-color);
68
67
  border-radius: 4px;
69
68
  margin-left: 4px;
70
69
 
71
- &:focus {
72
- outline: 0;
73
- }
74
-
75
70
  &:active {
76
71
  box-shadow: inset 0px 0px 0px 2px var(--openapi-input-border);
77
72
  }
@@ -102,10 +97,6 @@
102
97
  background-color: var(--openapi-input-border);
103
98
  }
104
99
 
105
- &:focus {
106
- outline: 0;
107
- }
108
-
109
100
  &:active {
110
101
  box-shadow:
111
102
  inset 0 0 0 1px var(--openapi-input-border),
@@ -1,7 +1,17 @@
1
1
  import React from "react";
2
2
  import { Param } from "./slice";
3
+ export interface LabelProps {
4
+ label?: string;
5
+ type?: string;
6
+ required?: boolean;
7
+ }
3
8
  export interface ParamProps {
4
9
  param: Param;
5
10
  }
11
+ /**
12
+ * Extracts enum values from a schema, including when wrapped in allOf.
13
+ * This handles cases where an enum is referenced via allOf for composition.
14
+ */
15
+ export declare function getSchemaEnum(schema: any): any[] | undefined;
6
16
  declare function ParamOptions(): React.JSX.Element;
7
17
  export default ParamOptions;
@@ -67,6 +67,7 @@ var __importDefault =
67
67
  return mod && mod.__esModule ? mod : { default: mod };
68
68
  };
69
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
+ exports.getSchemaEnum = getSchemaEnum;
70
71
  const react_1 = __importStar(require("react"));
71
72
  const Translate_1 = require("@docusaurus/Translate");
72
73
  const FormItem_1 = __importDefault(require("@theme/ApiExplorer/FormItem"));
@@ -87,42 +88,88 @@ const ParamTextFormItem_1 = __importDefault(
87
88
  );
88
89
  const hooks_1 = require("@theme/ApiItem/hooks");
89
90
  const translationIds_1 = require("@theme/translationIds");
90
- function ParamOption({ param }) {
91
- if (param.schema?.type === "array" && param.schema.items?.enum) {
91
+ /**
92
+ * Extracts enum values from a schema, including when wrapped in allOf.
93
+ * This handles cases where an enum is referenced via allOf for composition.
94
+ */
95
+ function getSchemaEnum(schema) {
96
+ // Direct enum on schema
97
+ if (schema?.enum) {
98
+ return schema.enum;
99
+ }
100
+ // Enum inside allOf - check each item
101
+ if (schema?.allOf && Array.isArray(schema.allOf)) {
102
+ for (const item of schema.allOf) {
103
+ if (item.enum) {
104
+ return item.enum;
105
+ }
106
+ }
107
+ }
108
+ // const is semantically a single-value enum
109
+ if (schema?.const !== undefined) {
110
+ return [schema.const];
111
+ }
112
+ return undefined;
113
+ }
114
+ function ParamOption({ param, label, type, required }) {
115
+ const schemaEnum = getSchemaEnum(param.schema);
116
+ const itemsEnum = getSchemaEnum(param.schema?.items);
117
+ if (param.schema?.type === "array" && itemsEnum) {
92
118
  return react_1.default.createElement(ParamMultiSelectFormItem_1.default, {
93
119
  param: param,
120
+ label: label,
121
+ type: type,
122
+ required: required,
94
123
  });
95
124
  }
96
125
  if (param.schema?.type === "array") {
97
126
  return react_1.default.createElement(ParamArrayFormItem_1.default, {
98
127
  param: param,
128
+ label: label,
129
+ type: type,
130
+ required: required,
99
131
  });
100
132
  }
101
- if (param.schema?.enum) {
133
+ if (schemaEnum) {
102
134
  return react_1.default.createElement(ParamSelectFormItem_1.default, {
103
135
  param: param,
136
+ label: label,
137
+ type: type,
138
+ required: required,
104
139
  });
105
140
  }
106
141
  if (param.schema?.type === "boolean") {
107
142
  return react_1.default.createElement(ParamBooleanFormItem_1.default, {
108
143
  param: param,
144
+ label: label,
145
+ type: type,
146
+ required: required,
109
147
  });
110
148
  }
111
149
  // integer, number, string, int32, int64, float, double, object, byte, binary,
112
150
  // date-time, date, password
113
151
  return react_1.default.createElement(ParamTextFormItem_1.default, {
114
152
  param: param,
153
+ label: label,
154
+ type: type,
155
+ required: required,
115
156
  });
116
157
  }
117
158
  function ParamOptionWrapper({ param }) {
118
159
  return react_1.default.createElement(
119
160
  FormItem_1.default,
120
- { label: param.name, type: param.in, required: param.required },
121
- react_1.default.createElement(ParamOption, { param: param })
161
+ null,
162
+ react_1.default.createElement(ParamOption, {
163
+ param: param,
164
+ label: param.name,
165
+ type: param.in,
166
+ required: param.required,
167
+ })
122
168
  );
123
169
  }
124
170
  function ParamOptions() {
125
171
  const [showOptional, setShowOptional] = (0, react_1.useState)(false);
172
+ const optionalId = (0, react_1.useId)();
126
173
  const pathParams = (0, hooks_1.useTypedSelector)(
127
174
  (state) => state.params.path
128
175
  );
@@ -161,6 +208,8 @@ function ParamOptions() {
161
208
  {
162
209
  type: "button",
163
210
  className: "openapi-explorer__show-more-btn",
211
+ "aria-expanded": showOptional,
212
+ "aria-controls": optionalId,
164
213
  onClick: () => setShowOptional((prev) => !prev),
165
214
  },
166
215
  react_1.default.createElement(
@@ -219,6 +268,7 @@ function ParamOptions() {
219
268
  className: showOptional
220
269
  ? "openapi-explorer__show-options"
221
270
  : "openapi-explorer__hide-options",
271
+ id: optionalId,
222
272
  },
223
273
  optionalParams.map((param) =>
224
274
  react_1.default.createElement(ParamOptionWrapper, {
@@ -1,4 +1,4 @@
1
- import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
1
+ import type { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
2
2
  export type Param = ParameterObject & {
3
3
  value?: string[] | string;
4
4
  };
@@ -48,6 +48,17 @@
48
48
  }
49
49
 
50
50
  .openapi-explorer__expand-details-btn {
51
+ -webkit-appearance: none;
52
+ -moz-appearance: none;
53
+ appearance: none;
54
+ padding: 0;
55
+ cursor: pointer;
56
+ border: 0px solid transparent;
57
+ background-color: transparent;
58
+ text-transform: inherit;
59
+ font-weight: inherit;
60
+ font-size: inherit;
61
+
51
62
  &:hover {
52
63
  cursor: pointer;
53
64
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
2
+ import type { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
3
3
  declare function Request({ item }: {
4
4
  item: ApiItem;
5
5
  }): React.JSX.Element | null;
@@ -90,6 +90,7 @@ const ParamOptions_1 = __importDefault(
90
90
  );
91
91
  const slice_1 = require("@theme/ApiExplorer/Response/slice");
92
92
  const Server_1 = __importDefault(require("@theme/ApiExplorer/Server"));
93
+ const useResolvedEncoding_1 = require("@theme/ApiExplorer/EncodingSelection/useResolvedEncoding");
93
94
  const hooks_1 = require("@theme/ApiItem/hooks");
94
95
  const translationIds_1 = require("@theme/translationIds");
95
96
  const sdk = __importStar(require("postman-collection"));
@@ -103,6 +104,7 @@ function Request({ item }) {
103
104
  const { siteConfig } = (0, useDocusaurusContext_1.default)();
104
105
  const themeConfig = siteConfig.themeConfig;
105
106
  const requestTimeout = themeConfig.api?.requestTimeout;
107
+ const requestCredentials = themeConfig.api?.requestCredentials;
106
108
  // Frontmatter proxy (per-spec) takes precedence over theme config proxy (site-wide)
107
109
  const proxy = frontMatterProxy ?? themeConfig.api?.proxy;
108
110
  const pathParams = (0, hooks_1.useTypedSelector)(
@@ -139,12 +141,16 @@ function Request({ item }) {
139
141
  const [expandBody, setExpandBody] = (0, react_1.useState)(true);
140
142
  const [expandParams, setExpandParams] = (0, react_1.useState)(true);
141
143
  const [expandServer, setExpandServer] = (0, react_1.useState)(true);
144
+ const serverLabelId = (0, react_1.useId)();
142
145
  const allParams = [
143
146
  ...pathParams,
144
147
  ...queryParams,
145
148
  ...cookieParams,
146
149
  ...headerParams,
147
150
  ];
151
+ const encoding = (0, useResolvedEncoding_1.useResolvedEncoding)(
152
+ item.requestBody
153
+ );
148
154
  const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
149
155
  queryParams,
150
156
  pathParams,
@@ -155,6 +161,7 @@ function Request({ item }) {
155
161
  body,
156
162
  server,
157
163
  auth,
164
+ encoding,
158
165
  });
159
166
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
160
167
  const paramsObject = {
@@ -166,7 +173,7 @@ function Request({ item }) {
166
173
  item.parameters?.forEach((param) => {
167
174
  const paramType = param.in;
168
175
  const paramsArray = paramsObject[paramType];
169
- paramsArray.push(param);
176
+ paramsArray?.push(param);
170
177
  });
171
178
  const methods = (0, react_hook_form_1.useForm)({ shouldFocusError: false });
172
179
  const handleEventStream = async (res) => {
@@ -233,7 +240,9 @@ function Request({ item }) {
233
240
  postmanRequest,
234
241
  proxy,
235
242
  body,
236
- requestTimeout
243
+ requestTimeout,
244
+ requestCredentials,
245
+ encoding
237
246
  );
238
247
  if (res.headers.get("content-type")?.includes("text/event-stream")) {
239
248
  await handleEventStream(res);
@@ -311,8 +320,9 @@ function Request({ item }) {
311
320
  ),
312
321
  allDetailsExpanded
313
322
  ? react_1.default.createElement(
314
- "span",
323
+ "button",
315
324
  {
325
+ type: "button",
316
326
  className: "openapi-explorer__expand-details-btn",
317
327
  onClick: collapseAllDetails,
318
328
  },
@@ -322,8 +332,9 @@ function Request({ item }) {
322
332
  })
323
333
  )
324
334
  : react_1.default.createElement(
325
- "span",
335
+ "button",
326
336
  {
337
+ type: "button",
327
338
  className: "openapi-explorer__expand-details-btn",
328
339
  onClick: expandAllDetails,
329
340
  },
@@ -347,6 +358,7 @@ function Request({ item }) {
347
358
  react_1.default.createElement(
348
359
  "summary",
349
360
  {
361
+ id: serverLabelId,
350
362
  className: "openapi-explorer__details-summary",
351
363
  onClick: (e) => {
352
364
  e.preventDefault();
@@ -358,7 +370,9 @@ function Request({ item }) {
358
370
  message: "Base URL",
359
371
  })
360
372
  ),
361
- react_1.default.createElement(Server_1.default, null)
373
+ react_1.default.createElement(Server_1.default, {
374
+ labelId: serverLabelId,
375
+ })
362
376
  ),
363
377
  showAuth &&
364
378
  react_1.default.createElement(