docusaurus-theme-openapi-docs 0.0.0-1050 → 0.0.0-1055

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 (56) hide show
  1. package/lib/theme/ApiExplorer/Authorization/index.js +44 -8
  2. package/lib/theme/ApiExplorer/Body/index.js +16 -3
  3. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
  4. package/lib/theme/ApiExplorer/CodeSnippets/index.js +35 -24
  5. package/lib/theme/ApiExplorer/FormFileUpload/index.js +6 -1
  6. package/lib/theme/ApiExplorer/FormItem/index.js +6 -1
  7. package/lib/theme/ApiExplorer/FormTextInput/index.js +8 -1
  8. package/lib/theme/ApiExplorer/LiveEditor/index.js +9 -1
  9. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +10 -1
  10. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +10 -1
  11. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +10 -1
  12. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +10 -1
  13. package/lib/theme/ApiExplorer/ParamOptions/index.js +11 -1
  14. package/lib/theme/ApiExplorer/Request/index.js +59 -12
  15. package/lib/theme/ApiExplorer/Response/index.js +27 -13
  16. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +167 -19
  17. package/lib/theme/ApiExplorer/Server/index.js +16 -2
  18. package/lib/theme/ApiExplorer/index.js +4 -0
  19. package/lib/theme/ApiTabs/index.js +6 -1
  20. package/lib/theme/ParamsDetails/index.js +9 -1
  21. package/lib/theme/ParamsItem/index.js +63 -8
  22. package/lib/theme/RequestSchema/index.js +10 -2
  23. package/lib/theme/ResponseExamples/index.js +23 -3
  24. package/lib/theme/ResponseSchema/index.js +7 -1
  25. package/lib/theme/SchemaItem/index.js +68 -9
  26. package/lib/theme/StatusCodes/index.js +11 -2
  27. package/lib/theme/translationIds.d.ts +73 -0
  28. package/lib/theme/translationIds.js +96 -0
  29. package/package.json +3 -3
  30. package/src/theme/ApiExplorer/Authorization/index.tsx +44 -8
  31. package/src/theme/ApiExplorer/Body/index.tsx +15 -3
  32. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +38 -24
  33. package/src/theme/ApiExplorer/FormFileUpload/index.tsx +6 -1
  34. package/src/theme/ApiExplorer/FormItem/index.tsx +8 -1
  35. package/src/theme/ApiExplorer/FormTextInput/index.tsx +8 -1
  36. package/src/theme/ApiExplorer/LiveEditor/index.tsx +9 -1
  37. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +10 -1
  38. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +10 -1
  39. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +10 -1
  40. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +10 -1
  41. package/src/theme/ApiExplorer/ParamOptions/index.tsx +10 -2
  42. package/src/theme/ApiExplorer/Request/index.tsx +55 -12
  43. package/src/theme/ApiExplorer/Response/index.tsx +23 -7
  44. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +117 -19
  45. package/src/theme/ApiExplorer/Server/index.tsx +10 -2
  46. package/src/theme/ApiExplorer/index.tsx +5 -0
  47. package/src/theme/ApiTabs/index.tsx +6 -1
  48. package/src/theme/ParamsDetails/index.tsx +10 -1
  49. package/src/theme/ParamsItem/index.tsx +45 -8
  50. package/src/theme/RequestSchema/index.tsx +11 -2
  51. package/src/theme/ResponseExamples/index.tsx +23 -3
  52. package/src/theme/ResponseSchema/index.tsx +7 -1
  53. package/src/theme/SchemaItem/index.tsx +49 -9
  54. package/src/theme/StatusCodes/index.tsx +13 -2
  55. package/src/theme/translationIds.ts +93 -0
  56. package/tsconfig.tsbuildinfo +1 -1
@@ -12,12 +12,14 @@ 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");
15
16
  const FormItem_1 = __importDefault(require("@theme/ApiExplorer/FormItem"));
16
17
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
17
18
  const FormTextInput_1 = __importDefault(
18
19
  require("@theme/ApiExplorer/FormTextInput")
19
20
  );
20
21
  const hooks_1 = require("@theme/ApiItem/hooks");
22
+ const translationIds_1 = require("@theme/translationIds");
21
23
  const slice_1 = require("./slice");
22
24
  function Authorization() {
23
25
  const data = (0, hooks_1.useTypedSelector)((state) => state.auth.data);
@@ -50,9 +52,18 @@ function Authorization() {
50
52
  if (a.type === "http" && a.scheme === "bearer") {
51
53
  return react_1.default.createElement(
52
54
  FormItem_1.default,
53
- { label: "Bearer Token", key: a.key + "-bearer" },
55
+ {
56
+ label: (0, Translate_1.translate)({
57
+ id: translationIds_1.OPENAPI_AUTH.BEARER_TOKEN,
58
+ message: "Bearer Token",
59
+ }),
60
+ key: a.key + "-bearer",
61
+ },
54
62
  react_1.default.createElement(FormTextInput_1.default, {
55
- placeholder: "Bearer Token",
63
+ placeholder: (0, Translate_1.translate)({
64
+ id: translationIds_1.OPENAPI_AUTH.BEARER_TOKEN,
65
+ message: "Bearer Token",
66
+ }),
56
67
  password: true,
57
68
  value: data[a.key].token ?? "",
58
69
  onChange: (e) => {
@@ -71,9 +82,18 @@ function Authorization() {
71
82
  if (a.type === "oauth2") {
72
83
  return react_1.default.createElement(
73
84
  FormItem_1.default,
74
- { label: "Bearer Token", key: a.key + "-oauth2" },
85
+ {
86
+ label: (0, Translate_1.translate)({
87
+ id: translationIds_1.OPENAPI_AUTH.BEARER_TOKEN,
88
+ message: "Bearer Token",
89
+ }),
90
+ key: a.key + "-oauth2",
91
+ },
75
92
  react_1.default.createElement(FormTextInput_1.default, {
76
- placeholder: "Bearer Token",
93
+ placeholder: (0, Translate_1.translate)({
94
+ id: translationIds_1.OPENAPI_AUTH.BEARER_TOKEN,
95
+ message: "Bearer Token",
96
+ }),
77
97
  password: true,
78
98
  value: data[a.key].token ?? "",
79
99
  onChange: (e) => {
@@ -95,9 +115,17 @@ function Authorization() {
95
115
  { key: a.key + "-basic" },
96
116
  react_1.default.createElement(
97
117
  FormItem_1.default,
98
- { label: "Username" },
118
+ {
119
+ label: (0, Translate_1.translate)({
120
+ id: translationIds_1.OPENAPI_AUTH.USERNAME,
121
+ message: "Username",
122
+ }),
123
+ },
99
124
  react_1.default.createElement(FormTextInput_1.default, {
100
- placeholder: "Username",
125
+ placeholder: (0, Translate_1.translate)({
126
+ id: translationIds_1.OPENAPI_AUTH.USERNAME,
127
+ message: "Username",
128
+ }),
101
129
  value: data[a.key].username ?? "",
102
130
  onChange: (e) => {
103
131
  const value = e.target.value;
@@ -113,9 +141,17 @@ function Authorization() {
113
141
  ),
114
142
  react_1.default.createElement(
115
143
  FormItem_1.default,
116
- { label: "Password" },
144
+ {
145
+ label: (0, Translate_1.translate)({
146
+ id: translationIds_1.OPENAPI_AUTH.PASSWORD,
147
+ message: "Password",
148
+ }),
149
+ },
117
150
  react_1.default.createElement(FormTextInput_1.default, {
118
- placeholder: "Password",
151
+ placeholder: (0, Translate_1.translate)({
152
+ id: translationIds_1.OPENAPI_AUTH.PASSWORD,
153
+ message: "Password",
154
+ }),
119
155
  password: true,
120
156
  value: data[a.key].password ?? "",
121
157
  onChange: (e) => {
@@ -12,6 +12,7 @@ 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");
15
16
  const json2xml_1 = __importDefault(require("@theme/ApiExplorer/Body/json2xml"));
16
17
  const FormFileUpload_1 = __importDefault(
17
18
  require("@theme/ApiExplorer/FormFileUpload")
@@ -26,6 +27,7 @@ const hooks_1 = require("@theme/ApiItem/hooks");
26
27
  const Markdown_1 = __importDefault(require("@theme/Markdown"));
27
28
  const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
28
29
  const TabItem_1 = __importDefault(require("@theme/TabItem"));
30
+ const translationIds_1 = require("@theme/translationIds");
29
31
  const xml_formatter_1 = __importDefault(require("xml-formatter"));
30
32
  const slice_1 = require("./slice");
31
33
  function BodyWrap({
@@ -85,7 +87,12 @@ function Body({
85
87
  FormItem_1.default,
86
88
  null,
87
89
  react_1.default.createElement(FormFileUpload_1.default, {
88
- placeholder: schema.description || "Body",
90
+ placeholder:
91
+ schema.description ||
92
+ (0, Translate_1.translate)({
93
+ id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
94
+ message: "Body",
95
+ }),
89
96
  onChange: (file) => {
90
97
  if (file === undefined) {
91
98
  dispatch((0, slice_1.clearRawBody)());
@@ -291,7 +298,10 @@ function Body({
291
298
  react_1.default.createElement(
292
299
  TabItem_1.default,
293
300
  {
294
- label: "Example (from schema)",
301
+ label: (0, Translate_1.translate)({
302
+ id: translationIds_1.OPENAPI_BODY.EXAMPLE_FROM_SCHEMA,
303
+ message: "Example (from schema)",
304
+ }),
295
305
  value: "Example (from schema)",
296
306
  default: true,
297
307
  },
@@ -330,7 +340,10 @@ function Body({
330
340
  react_1.default.createElement(
331
341
  TabItem_1.default,
332
342
  {
333
- label: "Example (from schema)",
343
+ label: (0, Translate_1.translate)({
344
+ id: translationIds_1.OPENAPI_BODY.EXAMPLE_FROM_SCHEMA,
345
+ message: "Example (from schema)",
346
+ }),
334
347
  value: "Example (from schema)",
335
348
  default: true,
336
349
  },
@@ -5,6 +5,7 @@ export declare const languageSet: Language[];
5
5
  export interface Props {
6
6
  postman: sdk.Request;
7
7
  codeSamples: CodeSample[];
8
+ maskCredentials?: boolean;
8
9
  }
9
- declare function CodeSnippets({ postman, codeSamples }: Props): React.JSX.Element | null;
10
+ declare function CodeSnippets({ postman, codeSamples, maskCredentials: propMaskCredentials, }: Props): React.JSX.Element | null;
10
11
  export default CodeSnippets;
@@ -93,7 +93,11 @@ function CodeTab({ children, hidden, className }) {
93
93
  children
94
94
  );
95
95
  }
96
- function CodeSnippets({ postman, codeSamples }) {
96
+ function CodeSnippets({
97
+ postman,
98
+ codeSamples,
99
+ maskCredentials: propMaskCredentials,
100
+ }) {
97
101
  const { siteConfig } = (0, useDocusaurusContext_1.default)();
98
102
  const contentType = (0, hooks_1.useTypedSelector)(
99
103
  (state) => state.contentType.value
@@ -114,29 +118,36 @@ function CodeSnippets({ postman, codeSamples }) {
114
118
  (state) => state.params.header
115
119
  );
116
120
  const auth = (0, hooks_1.useTypedSelector)((state) => state.auth);
117
- const clonedAuth = (0, cloneDeep_1.default)(auth);
118
- let placeholder;
119
- function cleanCredentials(obj) {
120
- for (const key in obj) {
121
- if (typeof obj[key] === "object" && obj[key] !== null) {
122
- // use name as placeholder if exists
123
- const comboAuthId = Object.keys(obj).join(" and ");
124
- const authOptions =
125
- clonedAuth?.options?.[key] ?? clonedAuth?.options?.[comboAuthId];
126
- placeholder = authOptions?.[0]?.name;
127
- obj[key] = cleanCredentials(obj[key]);
128
- } else {
129
- obj[key] = `<${placeholder ?? key}>`;
130
- }
131
- }
132
- return obj;
133
- }
134
- // scrub credentials from code snippets
135
- const cleanedAuth = {
136
- ...clonedAuth,
137
- data: cleanCredentials(clonedAuth.data),
138
- };
139
- // Create a Postman request object using cleanedAuth
121
+ // Check if credential masking is enabled (default: true)
122
+ const maskCredentials = propMaskCredentials ?? true;
123
+ // Clone Auth if maskCredentials is not false
124
+ const cleanedAuth = maskCredentials
125
+ ? (() => {
126
+ const clonedAuth = (0, cloneDeep_1.default)(auth);
127
+ let placeholder;
128
+ function cleanCredentials(obj) {
129
+ for (const key in obj) {
130
+ if (typeof obj[key] === "object" && obj[key] !== null) {
131
+ // use name as placeholder if exists
132
+ const comboAuthId = Object.keys(obj).join(" and ");
133
+ const authOptions =
134
+ clonedAuth?.options?.[key] ??
135
+ clonedAuth?.options?.[comboAuthId];
136
+ placeholder = authOptions?.[0]?.name;
137
+ obj[key] = cleanCredentials(obj[key]);
138
+ } else {
139
+ obj[key] = `<${placeholder ?? key}>`;
140
+ }
141
+ }
142
+ return obj;
143
+ }
144
+ return {
145
+ ...clonedAuth,
146
+ data: cleanCredentials(clonedAuth.data),
147
+ };
148
+ })()
149
+ : auth;
150
+ // Create a Postman request object using cleanedAuth or original auth
140
151
  const cleanedPostmanRequest = (0, buildPostmanRequest_1.default)(postman, {
141
152
  queryParams,
142
153
  pathParams,
@@ -68,9 +68,11 @@ var __importDefault =
68
68
  };
69
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
70
  const react_1 = __importStar(require("react"));
71
+ const Translate_1 = require("@docusaurus/Translate");
71
72
  const FloatingButton_1 = __importDefault(
72
73
  require("@theme/ApiExplorer/FloatingButton")
73
74
  );
75
+ const translationIds_1 = require("@theme/translationIds");
74
76
  const react_magic_dropzone_1 = __importDefault(require("react-magic-dropzone"));
75
77
  function RenderPreview({ file }) {
76
78
  switch (file.type) {
@@ -158,7 +160,10 @@ function FormFileUpload({ placeholder, onChange }) {
158
160
  setAndNotifyFile(undefined);
159
161
  },
160
162
  },
161
- "Clear"
163
+ (0, Translate_1.translate)({
164
+ id: translationIds_1.OPENAPI_FORM_FILE_UPLOAD.CLEAR_BUTTON,
165
+ message: "Clear",
166
+ })
162
167
  ),
163
168
  react_1.default.createElement(RenderPreview, { file: file })
164
169
  )
@@ -12,6 +12,8 @@ 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");
15
17
  const clsx_1 = __importDefault(require("clsx"));
16
18
  function FormItem({ label, type, required, children, className }) {
17
19
  return react_1.default.createElement(
@@ -36,7 +38,10 @@ function FormItem({ label, type, required, children, className }) {
36
38
  react_1.default.createElement(
37
39
  "span",
38
40
  { className: "openapi-schema__required" },
39
- "required"
41
+ (0, Translate_1.translate)({
42
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
43
+ message: "required",
44
+ })
40
45
  ),
41
46
  react_1.default.createElement("div", null, children)
42
47
  );
@@ -13,7 +13,9 @@ var __importDefault =
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  // @ts-nocheck
15
15
  const react_1 = __importDefault(require("react"));
16
+ const Translate_1 = require("@docusaurus/Translate");
16
17
  const error_message_1 = require("@hookform/error-message");
18
+ const translationIds_1 = require("@theme/translationIds");
17
19
  const clsx_1 = __importDefault(require("clsx"));
18
20
  const react_hook_form_1 = require("react-hook-form");
19
21
  function FormTextInput({
@@ -36,7 +38,12 @@ function FormTextInput({
36
38
  paramName
37
39
  ? react_1.default.createElement("input", {
38
40
  ...register(paramName, {
39
- required: isRequired ? "This field is required" : false,
41
+ required: isRequired
42
+ ? (0, Translate_1.translate)({
43
+ id: translationIds_1.OPENAPI_FORM.FIELD_REQUIRED,
44
+ message: "This field is required",
45
+ })
46
+ : false,
40
47
  }),
41
48
  className: (0, clsx_1.default)("openapi-explorer__form-item-input", {
42
49
  error: showErrorMessage,
@@ -69,9 +69,11 @@ var __importDefault =
69
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
70
  const react_1 = __importStar(require("react"));
71
71
  const theme_common_1 = require("@docusaurus/theme-common");
72
+ const Translate_1 = require("@docusaurus/Translate");
72
73
  const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
73
74
  const error_message_1 = require("@hookform/error-message");
74
75
  const slice_1 = require("@theme/ApiExplorer/Body/slice");
76
+ const translationIds_1 = require("@theme/translationIds");
75
77
  const clsx_1 = __importDefault(require("clsx"));
76
78
  const react_hook_form_1 = require("react-hook-form");
77
79
  const react_live_1 = require("react-live");
@@ -140,7 +142,13 @@ function App({
140
142
  react_1.default.createElement(react_hook_form_1.Controller, {
141
143
  control: control,
142
144
  rules: {
143
- required: isRequired && !code ? "This field is required" : false,
145
+ required:
146
+ isRequired && !code
147
+ ? (0, Translate_1.translate)({
148
+ id: translationIds_1.OPENAPI_FORM.FIELD_REQUIRED,
149
+ message: "This field is required",
150
+ })
151
+ : false,
144
152
  },
145
153
  name: "requestBody",
146
154
  render: ({ field: { onChange, name } }) =>
@@ -69,6 +69,7 @@ var __importDefault =
69
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
70
  exports.default = ParamArrayFormItem;
71
71
  const react_1 = __importStar(require("react"));
72
+ const Translate_1 = require("@docusaurus/Translate");
72
73
  const error_message_1 = require("@hookform/error-message");
73
74
  const toolkit_1 = require("@reduxjs/toolkit");
74
75
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
@@ -77,6 +78,7 @@ const FormTextInput_1 = __importDefault(
77
78
  );
78
79
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
79
80
  const hooks_1 = require("@theme/ApiItem/hooks");
81
+ const translationIds_1 = require("@theme/translationIds");
80
82
  const react_hook_form_1 = require("react-hook-form");
81
83
  function ArrayItem({ param, onChange, initialValue }) {
82
84
  const [value, setValue] = (0, react_1.useState)(initialValue || "");
@@ -157,7 +159,14 @@ function ParamArrayFormItem({ param }) {
157
159
  null,
158
160
  react_1.default.createElement(react_hook_form_1.Controller, {
159
161
  control: control,
160
- rules: { required: param.required ? "This field is required" : false },
162
+ rules: {
163
+ required: param.required
164
+ ? (0, Translate_1.translate)({
165
+ id: translationIds_1.OPENAPI_FORM.FIELD_REQUIRED,
166
+ message: "This field is required",
167
+ })
168
+ : false,
169
+ },
161
170
  name: "paramArray",
162
171
  render: ({ field: { onChange, name } }) =>
163
172
  react_1.default.createElement(
@@ -13,10 +13,12 @@ var __importDefault =
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.default = ParamBooleanFormItem;
15
15
  const react_1 = __importDefault(require("react"));
16
+ const Translate_1 = require("@docusaurus/Translate");
16
17
  const error_message_1 = require("@hookform/error-message");
17
18
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
18
19
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
19
20
  const hooks_1 = require("@theme/ApiItem/hooks");
21
+ const translationIds_1 = require("@theme/translationIds");
20
22
  const react_hook_form_1 = require("react-hook-form");
21
23
  function ParamBooleanFormItem({ param }) {
22
24
  const dispatch = (0, hooks_1.useTypedDispatch)();
@@ -30,7 +32,14 @@ function ParamBooleanFormItem({ param }) {
30
32
  null,
31
33
  react_1.default.createElement(react_hook_form_1.Controller, {
32
34
  control: control,
33
- rules: { required: param.required ? "This field is required" : false },
35
+ rules: {
36
+ required: param.required
37
+ ? (0, Translate_1.translate)({
38
+ id: translationIds_1.OPENAPI_FORM.FIELD_REQUIRED,
39
+ message: "This field is required",
40
+ })
41
+ : false,
42
+ },
34
43
  name: "paramBoolean",
35
44
  render: ({ field: { onChange, name } }) =>
36
45
  react_1.default.createElement(FormSelect_1.default, {
@@ -13,12 +13,14 @@ var __importDefault =
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.default = ParamMultiSelectFormItem;
15
15
  const react_1 = __importDefault(require("react"));
16
+ const Translate_1 = require("@docusaurus/Translate");
16
17
  const error_message_1 = require("@hookform/error-message");
17
18
  const FormMultiSelect_1 = __importDefault(
18
19
  require("@theme/ApiExplorer/FormMultiSelect")
19
20
  );
20
21
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
21
22
  const hooks_1 = require("@theme/ApiItem/hooks");
23
+ const translationIds_1 = require("@theme/translationIds");
22
24
  const react_hook_form_1 = require("react-hook-form");
23
25
  function ParamMultiSelectFormItem({ param }) {
24
26
  const {
@@ -64,7 +66,14 @@ function ParamMultiSelectFormItem({ param }) {
64
66
  null,
65
67
  react_1.default.createElement(react_hook_form_1.Controller, {
66
68
  control: control,
67
- rules: { required: param.required ? "This field is required" : false },
69
+ rules: {
70
+ required: param.required
71
+ ? (0, Translate_1.translate)({
72
+ id: translationIds_1.OPENAPI_FORM.FIELD_REQUIRED,
73
+ message: "This field is required",
74
+ })
75
+ : false,
76
+ },
68
77
  name: "paramMultiSelect",
69
78
  render: ({ field: { onChange, name } }) =>
70
79
  react_1.default.createElement(FormMultiSelect_1.default, {
@@ -13,10 +13,12 @@ var __importDefault =
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.default = ParamSelectFormItem;
15
15
  const react_1 = __importDefault(require("react"));
16
+ const Translate_1 = require("@docusaurus/Translate");
16
17
  const error_message_1 = require("@hookform/error-message");
17
18
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
18
19
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
19
20
  const hooks_1 = require("@theme/ApiItem/hooks");
21
+ const translationIds_1 = require("@theme/translationIds");
20
22
  const react_hook_form_1 = require("react-hook-form");
21
23
  function ParamSelectFormItem({ param }) {
22
24
  const {
@@ -31,7 +33,14 @@ function ParamSelectFormItem({ param }) {
31
33
  null,
32
34
  react_1.default.createElement(react_hook_form_1.Controller, {
33
35
  control: control,
34
- rules: { required: param.required ? "This field is required" : false },
36
+ rules: {
37
+ required: param.required
38
+ ? (0, Translate_1.translate)({
39
+ id: translationIds_1.OPENAPI_FORM.FIELD_REQUIRED,
40
+ message: "This field is required",
41
+ })
42
+ : false,
43
+ },
35
44
  name: "paramSelect",
36
45
  render: ({ field: { onChange, name } }) =>
37
46
  react_1.default.createElement(FormSelect_1.default, {
@@ -68,6 +68,7 @@ var __importDefault =
68
68
  };
69
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
70
  const react_1 = __importStar(require("react"));
71
+ const Translate_1 = require("@docusaurus/Translate");
71
72
  const FormItem_1 = __importDefault(require("@theme/ApiExplorer/FormItem"));
72
73
  const ParamArrayFormItem_1 = __importDefault(
73
74
  require("@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem")
@@ -85,6 +86,7 @@ const ParamTextFormItem_1 = __importDefault(
85
86
  require("@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem")
86
87
  );
87
88
  const hooks_1 = require("@theme/ApiItem/hooks");
89
+ const translationIds_1 = require("@theme/translationIds");
88
90
  function ParamOption({ param }) {
89
91
  if (param.schema?.type === "array" && param.schema.items?.enum) {
90
92
  return react_1.default.createElement(ParamMultiSelectFormItem_1.default, {
@@ -201,7 +203,15 @@ function ParamOptions() {
201
203
  )
202
204
  )
203
205
  ),
204
- showOptional ? "Hide optional parameters" : "Show optional parameters"
206
+ showOptional
207
+ ? (0, Translate_1.translate)({
208
+ id: translationIds_1.OPENAPI_PARAM_OPTIONS.HIDE_OPTIONAL,
209
+ message: "Hide optional parameters",
210
+ })
211
+ : (0, Translate_1.translate)({
212
+ id: translationIds_1.OPENAPI_PARAM_OPTIONS.SHOW_OPTIONAL,
213
+ message: "Show optional parameters",
214
+ })
205
215
  ),
206
216
  react_1.default.createElement(
207
217
  "div",
@@ -70,6 +70,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
70
70
  // @ts-nocheck
71
71
  const react_1 = __importStar(require("react"));
72
72
  const client_1 = require("@docusaurus/plugin-content-docs/client");
73
+ const Translate_1 = require("@docusaurus/Translate");
73
74
  const Accept_1 = __importDefault(require("@theme/ApiExplorer/Accept"));
74
75
  const Authorization_1 = __importDefault(
75
76
  require("@theme/ApiExplorer/Authorization")
@@ -87,6 +88,7 @@ const ParamOptions_1 = __importDefault(
87
88
  const slice_1 = require("@theme/ApiExplorer/Response/slice");
88
89
  const Server_1 = __importDefault(require("@theme/ApiExplorer/Server"));
89
90
  const hooks_1 = require("@theme/ApiItem/hooks");
91
+ const translationIds_1 = require("@theme/translationIds");
90
92
  const sdk = __importStar(require("postman-collection"));
91
93
  const react_hook_form_1 = require("react-hook-form");
92
94
  const makeRequest_1 = __importDefault(require("./makeRequest"));
@@ -179,7 +181,14 @@ function Request({ item }) {
179
181
  dispatch((0, slice_1.setHeaders)(Object.fromEntries(res.headers)));
180
182
  };
181
183
  const onSubmit = async (data) => {
182
- dispatch((0, slice_1.setResponse)("Fetching..."));
184
+ dispatch(
185
+ (0, slice_1.setResponse)(
186
+ (0, Translate_1.translate)({
187
+ id: translationIds_1.OPENAPI_REQUEST.FETCHING_MESSAGE,
188
+ message: "Fetching...",
189
+ })
190
+ )
191
+ );
183
192
  try {
184
193
  await delay(1200);
185
194
  const res = await (0, makeRequest_1.default)(postmanRequest, proxy, body);
@@ -190,7 +199,14 @@ function Request({ item }) {
190
199
  }
191
200
  } catch (e) {
192
201
  console.log(e);
193
- dispatch((0, slice_1.setResponse)("Connection failed"));
202
+ dispatch(
203
+ (0, slice_1.setResponse)(
204
+ (0, Translate_1.translate)({
205
+ id: translationIds_1.OPENAPI_REQUEST.CONNECTION_FAILED,
206
+ message: "Connection failed",
207
+ })
208
+ )
209
+ );
194
210
  dispatch((0, slice_1.clearCode)());
195
211
  dispatch((0, slice_1.clearHeaders)());
196
212
  }
@@ -242,7 +258,10 @@ function Request({ item }) {
242
258
  react_1.default.createElement(
243
259
  "span",
244
260
  { className: "openapi-explorer__request-title" },
245
- "Request "
261
+ (0, Translate_1.translate)({
262
+ id: translationIds_1.OPENAPI_REQUEST.REQUEST_TITLE,
263
+ message: "Request",
264
+ })
246
265
  ),
247
266
  allDetailsExpanded
248
267
  ? react_1.default.createElement(
@@ -251,7 +270,10 @@ function Request({ item }) {
251
270
  className: "openapi-explorer__expand-details-btn",
252
271
  onClick: collapseAllDetails,
253
272
  },
254
- "Collapse all"
273
+ (0, Translate_1.translate)({
274
+ id: translationIds_1.OPENAPI_REQUEST.COLLAPSE_ALL,
275
+ message: "Collapse all",
276
+ })
255
277
  )
256
278
  : react_1.default.createElement(
257
279
  "span",
@@ -259,7 +281,10 @@ function Request({ item }) {
259
281
  className: "openapi-explorer__expand-details-btn",
260
282
  onClick: expandAllDetails,
261
283
  },
262
- "Expand all"
284
+ (0, Translate_1.translate)({
285
+ id: translationIds_1.OPENAPI_REQUEST.EXPAND_ALL,
286
+ message: "Expand all",
287
+ })
263
288
  )
264
289
  ),
265
290
  react_1.default.createElement(
@@ -282,7 +307,10 @@ function Request({ item }) {
282
307
  setExpandServer(!expandServer);
283
308
  },
284
309
  },
285
- "Base URL"
310
+ (0, Translate_1.translate)({
311
+ id: translationIds_1.OPENAPI_REQUEST.BASE_URL_TITLE,
312
+ message: "Base URL",
313
+ })
286
314
  ),
287
315
  react_1.default.createElement(Server_1.default, null)
288
316
  ),
@@ -302,7 +330,10 @@ function Request({ item }) {
302
330
  setExpandAuth(!expandAuth);
303
331
  },
304
332
  },
305
- "Auth"
333
+ (0, Translate_1.translate)({
334
+ id: translationIds_1.OPENAPI_REQUEST.AUTH_TITLE,
335
+ message: "Auth",
336
+ })
306
337
  ),
307
338
  react_1.default.createElement(Authorization_1.default, null)
308
339
  ),
@@ -323,7 +354,10 @@ function Request({ item }) {
323
354
  setExpandParams(!expandParams);
324
355
  },
325
356
  },
326
- "Parameters"
357
+ (0, Translate_1.translate)({
358
+ id: translationIds_1.OPENAPI_REQUEST.PARAMETERS_TITLE,
359
+ message: "Parameters",
360
+ })
327
361
  ),
328
362
  react_1.default.createElement(ParamOptions_1.default, null)
329
363
  ),
@@ -343,12 +377,19 @@ function Request({ item }) {
343
377
  setExpandBody(!expandBody);
344
378
  },
345
379
  },
346
- "Body",
380
+ (0, Translate_1.translate)({
381
+ id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
382
+ message: "Body",
383
+ }),
347
384
  requestBodyRequired &&
348
385
  react_1.default.createElement(
349
386
  "span",
350
387
  { className: "openapi-schema__required" },
351
- "\u00A0required"
388
+ "\u00A0",
389
+ (0, Translate_1.translate)({
390
+ id: translationIds_1.OPENAPI_REQUEST.REQUIRED_LABEL,
391
+ message: "required",
392
+ })
352
393
  )
353
394
  ),
354
395
  react_1.default.createElement(
@@ -378,7 +419,10 @@ function Request({ item }) {
378
419
  setExpandAccept(!expandAccept);
379
420
  },
380
421
  },
381
- "Accept"
422
+ (0, Translate_1.translate)({
423
+ id: translationIds_1.OPENAPI_REQUEST.ACCEPT_TITLE,
424
+ message: "Accept",
425
+ })
382
426
  ),
383
427
  react_1.default.createElement(Accept_1.default, null)
384
428
  ),
@@ -387,7 +431,10 @@ function Request({ item }) {
387
431
  react_1.default.createElement(
388
432
  "button",
389
433
  { className: "openapi-explorer__request-btn", type: "submit" },
390
- "Send API Request"
434
+ (0, Translate_1.translate)({
435
+ id: translationIds_1.OPENAPI_REQUEST.SEND_BUTTON,
436
+ message: "Send API Request",
437
+ })
391
438
  )
392
439
  )
393
440
  )