docusaurus-theme-openapi-docs 0.0.0-1294 → 0.0.0-1295

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 (60) hide show
  1. package/lib/markdown/schema.js +4 -5
  2. package/lib/theme/ApiExplorer/Authorization/index.js +9 -10
  3. package/lib/theme/ApiExplorer/Body/index.js +4 -5
  4. package/lib/theme/ApiExplorer/Export/index.js +9 -2
  5. package/lib/theme/ApiExplorer/FormFileUpload/index.js +1 -2
  6. package/lib/theme/ApiExplorer/FormLabel/index.js +1 -2
  7. package/lib/theme/ApiExplorer/FormTextInput/index.js +1 -2
  8. package/lib/theme/ApiExplorer/LiveEditor/index.js +1 -2
  9. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +5 -3
  10. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +1 -2
  11. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +1 -2
  12. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +1 -2
  13. package/lib/theme/ApiExplorer/ParamOptions/index.js +2 -3
  14. package/lib/theme/ApiExplorer/Request/index.js +17 -18
  15. package/lib/theme/ApiExplorer/Response/index.js +7 -11
  16. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +57 -50
  17. package/lib/theme/ApiExplorer/Server/index.js +2 -3
  18. package/lib/theme/ApiTabs/index.js +1 -2
  19. package/lib/theme/Example/index.js +3 -4
  20. package/lib/theme/ParamsDetails/index.js +1 -2
  21. package/lib/theme/ParamsItem/index.js +7 -8
  22. package/lib/theme/RequestSchema/index.js +4 -6
  23. package/lib/theme/ResponseExamples/index.js +3 -4
  24. package/lib/theme/ResponseSchema/index.js +2 -3
  25. package/lib/theme/Schema/index.js +8 -9
  26. package/lib/theme/SchemaExpansion/index.js +4 -5
  27. package/lib/theme/SchemaItem/index.js +9 -10
  28. package/lib/theme/StatusCodes/index.js +2 -4
  29. package/lib/theme/translationIds.d.ts +1 -99
  30. package/lib/theme/translationIds.js +0 -116
  31. package/package.json +3 -3
  32. package/src/markdown/schema.ts +4 -5
  33. package/src/theme/ApiExplorer/Authorization/index.tsx +9 -10
  34. package/src/theme/ApiExplorer/Body/index.tsx +7 -5
  35. package/src/theme/ApiExplorer/Export/index.tsx +6 -2
  36. package/src/theme/ApiExplorer/FormFileUpload/index.tsx +1 -2
  37. package/src/theme/ApiExplorer/FormLabel/index.tsx +1 -2
  38. package/src/theme/ApiExplorer/FormTextInput/index.tsx +1 -2
  39. package/src/theme/ApiExplorer/LiveEditor/index.tsx +1 -2
  40. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +5 -3
  41. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +1 -2
  42. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +1 -2
  43. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +1 -2
  44. package/src/theme/ApiExplorer/ParamOptions/index.tsx +2 -3
  45. package/src/theme/ApiExplorer/Request/index.tsx +23 -18
  46. package/src/theme/ApiExplorer/Response/index.tsx +10 -8
  47. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +60 -52
  48. package/src/theme/ApiExplorer/Server/index.tsx +8 -3
  49. package/src/theme/ApiTabs/index.tsx +1 -2
  50. package/src/theme/Example/index.tsx +3 -4
  51. package/src/theme/ParamsDetails/index.tsx +1 -2
  52. package/src/theme/ParamsItem/index.tsx +13 -8
  53. package/src/theme/RequestSchema/index.tsx +4 -5
  54. package/src/theme/ResponseExamples/index.tsx +3 -4
  55. package/src/theme/ResponseSchema/index.tsx +2 -3
  56. package/src/theme/Schema/index.tsx +8 -9
  57. package/src/theme/SchemaExpansion/index.tsx +4 -5
  58. package/src/theme/SchemaItem/index.tsx +18 -10
  59. package/src/theme/StatusCodes/index.tsx +2 -3
  60. package/src/theme/translationIds.ts +37 -113
@@ -11,7 +11,6 @@ import { translate } from "@docusaurus/Translate";
11
11
  import { Example } from "@theme/Example";
12
12
  import Markdown from "@theme/Markdown";
13
13
  /* eslint-disable import/no-extraneous-dependencies*/
14
- import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
15
14
  import clsx from "clsx";
16
15
 
17
16
  import { getQualifierMessage, getSchemaName } from "../../markdown/schema";
@@ -41,11 +40,11 @@ export interface Props {
41
40
  const getEnumDescriptionMarkdown = (enumDescriptions?: [string, string][]) => {
42
41
  if (enumDescriptions?.length) {
43
42
  const enumValue = translate({
44
- id: OPENAPI_SCHEMA_ITEM.ENUM_VALUE,
43
+ id: "theme.openapi.schemaItem.enumValue",
45
44
  message: "Enum Value",
46
45
  });
47
46
  const description = translate({
48
- id: OPENAPI_SCHEMA_ITEM.ENUM_DESCRIPTION,
47
+ id: "theme.openapi.schemaItem.enumDescription",
49
48
  message: "Description",
50
49
  });
51
50
  return `| ${enumValue} | ${description} |
@@ -92,13 +91,19 @@ function ParamsItem({ param, ...rest }: Props) {
92
91
 
93
92
  const renderSchemaRequired = guard(required, () => (
94
93
  <span className="openapi-schema__required">
95
- {translate({ id: OPENAPI_SCHEMA_ITEM.REQUIRED, message: "required" })}
94
+ {translate({
95
+ id: "theme.openapi.schemaItem.required",
96
+ message: "required",
97
+ })}
96
98
  </span>
97
99
  ));
98
100
 
99
101
  const renderDeprecated = guard(deprecated, () => (
100
102
  <span className="openapi-schema__deprecated">
101
- {translate({ id: OPENAPI_SCHEMA_ITEM.DEPRECATED, message: "deprecated" })}
103
+ {translate({
104
+ id: "theme.openapi.schemaItem.deprecated",
105
+ message: "deprecated",
106
+ })}
102
107
  </span>
103
108
  ));
104
109
 
@@ -113,7 +118,7 @@ function ParamsItem({ param, ...rest }: Props) {
113
118
  return undefined;
114
119
  }
115
120
  const label = translate({
116
- id: OPENAPI_SCHEMA_ITEM.CONSTANT_VALUE,
121
+ id: "theme.openapi.schemaItem.constantValue",
117
122
  message: "Constant value:",
118
123
  });
119
124
  return (
@@ -152,7 +157,7 @@ function ParamsItem({ param, ...rest }: Props) {
152
157
  <div>
153
158
  <strong>
154
159
  {translate({
155
- id: OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
160
+ id: "theme.openapi.schemaItem.defaultValue",
156
161
  message: "Default value:",
157
162
  })}{" "}
158
163
  </strong>
@@ -166,7 +171,7 @@ function ParamsItem({ param, ...rest }: Props) {
166
171
  <div>
167
172
  <strong>
168
173
  {translate({
169
- id: OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
174
+ id: "theme.openapi.schemaItem.defaultValue",
170
175
  message: "Default value:",
171
176
  })}{" "}
172
177
  </strong>
@@ -22,7 +22,6 @@ import SchemaExpansionControl from "@theme/SchemaExpansion";
22
22
  import SchemaTabs from "@theme/SchemaTabs";
23
23
  import SkeletonLoader from "@theme/SkeletonLoader";
24
24
  import TabItem from "@theme/TabItem";
25
- import { OPENAPI_REQUEST, OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
26
25
  import type { MediaTypeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
27
26
 
28
27
  interface Props {
@@ -81,13 +80,13 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
81
80
  <summary className="openapi-markdown__details-summary--with-control">
82
81
  <h3 className="openapi-markdown__details-summary-header-body">
83
82
  {translate({
84
- id: OPENAPI_REQUEST.BODY_TITLE,
83
+ id: "theme.openapi.request.body.title",
85
84
  message: title,
86
85
  })}
87
86
  {body.required === true && (
88
87
  <span className="openapi-schema__required">
89
88
  {translate({
90
- id: OPENAPI_SCHEMA_ITEM.REQUIRED,
89
+ id: "theme.openapi.schemaItem.required",
91
90
  message: "required",
92
91
  })}
93
92
  </span>
@@ -167,7 +166,7 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
167
166
  <summary className="openapi-markdown__details-summary--with-control">
168
167
  <h3 className="openapi-markdown__details-summary-header-body">
169
168
  {translate({
170
- id: OPENAPI_REQUEST.BODY_TITLE,
169
+ id: "theme.openapi.request.body.title",
171
170
  message: title,
172
171
  })}
173
172
  {firstBody.type === "array" && (
@@ -176,7 +175,7 @@ const RequestSchemaComponent: React.FC<Props> = ({ title, body, style }) => {
176
175
  {body.required && (
177
176
  <strong className="openapi-schema__required">
178
177
  {translate({
179
- id: OPENAPI_SCHEMA_ITEM.REQUIRED,
178
+ id: "theme.openapi.schemaItem.required",
180
179
  message: "required",
181
180
  })}
182
181
  </strong>
@@ -11,7 +11,6 @@ import { translate } from "@docusaurus/Translate";
11
11
  import CodeSamples from "@theme/CodeSamples";
12
12
  import Markdown from "@theme/Markdown";
13
13
  import TabItem from "@theme/TabItem";
14
- import { OPENAPI_RESPONSE_EXAMPLES } from "@theme/translationIds";
15
14
  import { sampleResponseFromSchema } from "docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample";
16
15
  import format from "xml-formatter";
17
16
 
@@ -115,7 +114,7 @@ export const ResponseExample: React.FC<ResponseExampleProps> = ({
115
114
  // @ts-ignore
116
115
  <TabItem
117
116
  label={translate({
118
- id: OPENAPI_RESPONSE_EXAMPLES.EXAMPLE,
117
+ id: "theme.openapi.responseExamples.example",
119
118
  message: "Example",
120
119
  })}
121
120
  value="Example"
@@ -173,7 +172,7 @@ export const ExampleFromSchema: React.FC<ExampleFromSchemaProps> = ({
173
172
  // @ts-ignore
174
173
  <TabItem
175
174
  label={translate({
176
- id: OPENAPI_RESPONSE_EXAMPLES.AUTO_EXAMPLE,
175
+ id: "theme.openapi.responseExamples.autoExample",
177
176
  message: "Example (auto)",
178
177
  })}
179
178
  value="Example (auto)"
@@ -192,7 +191,7 @@ export const ExampleFromSchema: React.FC<ExampleFromSchemaProps> = ({
192
191
  // @ts-ignore
193
192
  <TabItem
194
193
  label={translate({
195
- id: OPENAPI_RESPONSE_EXAMPLES.AUTO_EXAMPLE,
194
+ id: "theme.openapi.responseExamples.autoExample",
196
195
  message: "Example (auto)",
197
196
  })}
198
197
  value="Example (auto)"
@@ -22,7 +22,6 @@ import SchemaExpansionControl from "@theme/SchemaExpansion";
22
22
  import SchemaTabs from "@theme/SchemaTabs";
23
23
  import SkeletonLoader from "@theme/SkeletonLoader";
24
24
  import TabItem from "@theme/TabItem";
25
- import { OPENAPI_SCHEMA, OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
26
25
  import type { MediaTypeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
27
26
 
28
27
  interface Props {
@@ -72,7 +71,7 @@ const ResponseSchemaComponent: React.FC<Props> = ({
72
71
  <TabItem key={mimeType} label={mimeType} value={mimeType}>
73
72
  <div>
74
73
  {translate({
75
- id: OPENAPI_SCHEMA.NO_SCHEMA,
74
+ id: "theme.openapi.schema.noSchema",
76
75
  message: "No schema",
77
76
  })}
78
77
  </div>
@@ -98,7 +97,7 @@ const ResponseSchemaComponent: React.FC<Props> = ({
98
97
  {body.required === true && (
99
98
  <span className="openapi-schema__required">
100
99
  {translate({
101
- id: OPENAPI_SCHEMA_ITEM.REQUIRED,
100
+ id: "theme.openapi.schemaItem.required",
102
101
  message: "required",
103
102
  })}
104
103
  </span>
@@ -22,7 +22,6 @@ import {
22
22
  import SchemaItem from "@theme/SchemaItem";
23
23
  import SchemaTabs from "@theme/SchemaTabs";
24
24
  import TabItem from "@theme/TabItem";
25
- import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
26
25
  // eslint-disable-next-line import/no-extraneous-dependencies
27
26
  import { merge } from "allof-merge";
28
27
  import clsx from "clsx";
@@ -261,7 +260,7 @@ const Summary: React.FC<SummaryProps> = ({
261
260
  {nullable && (
262
261
  <span className="openapi-schema__nullable">
263
262
  {translate({
264
- id: OPENAPI_SCHEMA_ITEM.NULLABLE,
263
+ id: "theme.openapi.schemaItem.nullable",
265
264
  message: "nullable",
266
265
  })}
267
266
  </span>
@@ -269,7 +268,7 @@ const Summary: React.FC<SummaryProps> = ({
269
268
  {isRequired && (
270
269
  <span className="openapi-schema__required">
271
270
  {translate({
272
- id: OPENAPI_SCHEMA_ITEM.REQUIRED,
271
+ id: "theme.openapi.schemaItem.required",
273
272
  message: "required",
274
273
  })}
275
274
  </span>
@@ -277,7 +276,7 @@ const Summary: React.FC<SummaryProps> = ({
277
276
  {deprecated && (
278
277
  <span className="openapi-schema__deprecated">
279
278
  {translate({
280
- id: OPENAPI_SCHEMA_ITEM.DEPRECATED,
279
+ id: "theme.openapi.schemaItem.deprecated",
281
280
  message: "deprecated",
282
281
  })}
283
282
  </span>
@@ -314,8 +313,8 @@ const AnyOneOf: React.FC<SchemaProps> = ({
314
313
  }
315
314
 
316
315
  const type = schema.oneOf
317
- ? translate({ id: OPENAPI_SCHEMA_ITEM.ONE_OF, message: "oneOf" })
318
- : translate({ id: OPENAPI_SCHEMA_ITEM.ANY_OF, message: "anyOf" });
316
+ ? translate({ id: "theme.openapi.schemaItem.oneOf", message: "oneOf" })
317
+ : translate({ id: "theme.openapi.schemaItem.anyOf", message: "anyOf" });
319
318
 
320
319
  // Generate a unique ID for this anyOf/oneOf to prevent tab value collisions
321
320
  const uniqueId = React.useMemo(
@@ -364,12 +363,12 @@ const AnyOneOf: React.FC<SchemaProps> = ({
364
363
  if (!label) {
365
364
  if (anyOneSchema.oneOf) {
366
365
  label = translate({
367
- id: OPENAPI_SCHEMA_ITEM.ONE_OF,
366
+ id: "theme.openapi.schemaItem.oneOf",
368
367
  message: "oneOf",
369
368
  });
370
369
  } else if (anyOneSchema.anyOf) {
371
370
  label = translate({
372
- id: OPENAPI_SCHEMA_ITEM.ANY_OF,
371
+ id: "theme.openapi.schemaItem.anyOf",
373
372
  message: "anyOf",
374
373
  });
375
374
  } else {
@@ -550,7 +549,7 @@ const PropertyDiscriminator: React.FC<SchemaEdgeProps> = ({
550
549
  {required && (
551
550
  <span className="openapi-schema__required">
552
551
  {translate({
553
- id: OPENAPI_SCHEMA_ITEM.REQUIRED,
552
+ id: "theme.openapi.schemaItem.required",
554
553
  message: "required",
555
554
  })}
556
555
  </span>
@@ -16,7 +16,6 @@ import React, {
16
16
  } from "react";
17
17
 
18
18
  import { translate } from "@docusaurus/Translate";
19
- import { OPENAPI_SCHEMA_EXPANSION } from "@theme/translationIds";
20
19
  import clsx from "clsx";
21
20
 
22
21
  import { useSchemaExpansion } from "./context";
@@ -146,17 +145,17 @@ const SchemaExpansionControl: React.FC = () => {
146
145
  if (!config.enabled) return null;
147
146
 
148
147
  const buttonLabel = translate({
149
- id: OPENAPI_SCHEMA_EXPANSION.BUTTON_LABEL,
148
+ id: "theme.openapi.schema.expansion.button",
150
149
  message: "Schema expansion depth",
151
150
  description: "Aria/title tooltip for the schema expansion icon button",
152
151
  });
153
152
  const menuLabel = translate({
154
- id: OPENAPI_SCHEMA_EXPANSION.MENU_LABEL,
153
+ id: "theme.openapi.schema.expansion.menu",
155
154
  message: "Schema expansion depth options",
156
155
  description: "Accessible label for the expansion options menu",
157
156
  });
158
157
  const allLabel = translate({
159
- id: OPENAPI_SCHEMA_EXPANSION.ALL,
158
+ id: "theme.openapi.schema.expansion.all",
160
159
  message: "All",
161
160
  description: "Label for the expand-all option",
162
161
  });
@@ -201,7 +200,7 @@ const SchemaExpansionControl: React.FC = () => {
201
200
  ? allLabel
202
201
  : translate(
203
202
  {
204
- id: OPENAPI_SCHEMA_EXPANSION.DEPTH_OPTION,
203
+ id: "theme.openapi.schema.expansion.depthOption",
205
204
  message: "Expand to depth {depth}",
206
205
  description: "Accessible label for a depth option",
207
206
  },
@@ -10,7 +10,6 @@ import React, { ReactNode } from "react";
10
10
  import { translate } from "@docusaurus/Translate";
11
11
  import { Example } from "@theme/Example";
12
12
  import Markdown from "@theme/Markdown";
13
- import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
14
13
  import clsx from "clsx";
15
14
 
16
15
  import { getQualifierMessage } from "../../markdown/schema";
@@ -41,11 +40,11 @@ const transformEnumDescriptions = (
41
40
  const getEnumDescriptionMarkdown = (enumDescriptions?: [string, string][]) => {
42
41
  if (enumDescriptions?.length) {
43
42
  const enumValue = translate({
44
- id: OPENAPI_SCHEMA_ITEM.ENUM_VALUE,
43
+ id: "theme.openapi.schemaItem.enumValue",
45
44
  message: "Enum Value",
46
45
  });
47
46
  const description = translate({
48
- id: OPENAPI_SCHEMA_ITEM.ENUM_DESCRIPTION,
47
+ id: "theme.openapi.schemaItem.enumDescription",
49
48
  message: "Description",
50
49
  });
51
50
  return `| ${enumValue} | ${description} |
@@ -97,20 +96,29 @@ export default function SchemaItem(props: Props) {
97
96
  Array.isArray(required) ? required.includes(name) : required,
98
97
  () => (
99
98
  <span className="openapi-schema__required">
100
- {translate({ id: OPENAPI_SCHEMA_ITEM.REQUIRED, message: "required" })}
99
+ {translate({
100
+ id: "theme.openapi.schemaItem.required",
101
+ message: "required",
102
+ })}
101
103
  </span>
102
104
  )
103
105
  );
104
106
 
105
107
  const renderDeprecated = guard(deprecated, () => (
106
108
  <span className="openapi-schema__deprecated">
107
- {translate({ id: OPENAPI_SCHEMA_ITEM.DEPRECATED, message: "deprecated" })}
109
+ {translate({
110
+ id: "theme.openapi.schemaItem.deprecated",
111
+ message: "deprecated",
112
+ })}
108
113
  </span>
109
114
  ));
110
115
 
111
116
  const renderNullable = guard(nullable, () => (
112
117
  <span className="openapi-schema__nullable">
113
- {translate({ id: OPENAPI_SCHEMA_ITEM.NULLABLE, message: "nullable" })}
118
+ {translate({
119
+ id: "theme.openapi.schemaItem.nullable",
120
+ message: "nullable",
121
+ })}
114
122
  </span>
115
123
  ));
116
124
 
@@ -148,7 +156,7 @@ export default function SchemaItem(props: Props) {
148
156
  <div>
149
157
  <strong>
150
158
  {translate({
151
- id: OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
159
+ id: "theme.openapi.schemaItem.defaultValue",
152
160
  message: "Default value:",
153
161
  })}{" "}
154
162
  </strong>
@@ -162,7 +170,7 @@ export default function SchemaItem(props: Props) {
162
170
  <div>
163
171
  <strong>
164
172
  {translate({
165
- id: OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
173
+ id: "theme.openapi.schemaItem.defaultValue",
166
174
  message: "Default value:",
167
175
  })}{" "}
168
176
  </strong>
@@ -182,7 +190,7 @@ export default function SchemaItem(props: Props) {
182
190
  <div>
183
191
  <strong>
184
192
  {translate({
185
- id: OPENAPI_SCHEMA_ITEM.CONSTANT_VALUE,
193
+ id: "theme.openapi.schemaItem.constantValue",
186
194
  message: "Constant value:",
187
195
  })}{" "}
188
196
  </strong>
@@ -196,7 +204,7 @@ export default function SchemaItem(props: Props) {
196
204
  <div>
197
205
  <strong>
198
206
  {translate({
199
- id: OPENAPI_SCHEMA_ITEM.CONSTANT_VALUE,
207
+ id: "theme.openapi.schemaItem.constantValue",
200
208
  message: "Constant value:",
201
209
  })}{" "}
202
210
  </strong>
@@ -14,7 +14,6 @@ import Markdown from "@theme/Markdown";
14
14
  import ResponseHeaders from "@theme/ResponseHeaders";
15
15
  import ResponseSchema from "@theme/ResponseSchema";
16
16
  import TabItem from "@theme/TabItem";
17
- import { OPENAPI_STATUS_CODES } from "@theme/translationIds";
18
17
  import type { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
19
18
 
20
19
  interface Props {
@@ -55,7 +54,7 @@ const StatusCodes: React.FC<Props> = ({ label, id, responses }: any) => {
55
54
  <summary>
56
55
  <strong>
57
56
  {translate({
58
- id: OPENAPI_STATUS_CODES.RESPONSE_HEADERS,
57
+ id: "theme.openapi.statusCodes.responseHeaders",
59
58
  message: "Response Headers",
60
59
  })}
61
60
  </strong>
@@ -67,7 +66,7 @@ const StatusCodes: React.FC<Props> = ({ label, id, responses }: any) => {
67
66
  )}
68
67
  <ResponseSchema
69
68
  title={translate({
70
- id: OPENAPI_STATUS_CODES.SCHEMA_TITLE,
69
+ id: "theme.openapi.statusCodes.schemaTitle",
71
70
  message: "Schema",
72
71
  })}
73
72
  body={{ content: response.content }}
@@ -5,117 +5,41 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- export const OPENAPI_RESPONSE = {
9
- TITLE: "theme.openapi.response.title",
10
- CLEAR: "theme.openapi.response.clear",
11
- PLACEHOLDER: "theme.openapi.response.placeholder",
12
- HEADERS_TAB: "theme.openapi.response.headersTab",
13
- };
14
-
15
- export const OPENAPI_TABS = {
16
- RESPONSES_LABEL: "theme.openapi.tabs.responses.label",
17
- };
18
-
19
- export const OPENAPI_REQUEST = {
20
- BODY_TITLE: "theme.openapi.request.body.title",
21
- ACCEPT_TITLE: "theme.openapi.request.accept.title",
22
- SEND_BUTTON: "theme.openapi.request.sendButton",
23
- REQUIRED_LABEL: "theme.openapi.request.requiredLabel",
24
- REQUEST_TITLE: "theme.openapi.request.title",
25
- COLLAPSE_ALL: "theme.openapi.request.collapseAll",
26
- EXPAND_ALL: "theme.openapi.request.expandAll",
27
- BASE_URL_TITLE: "theme.openapi.request.baseUrl.title",
28
- AUTH_TITLE: "theme.openapi.request.auth.title",
29
- PARAMETERS_TITLE: "theme.openapi.request.parameters.title",
30
- FETCHING_MESSAGE: "theme.openapi.request.fetchingMessage",
31
- CONNECTION_FAILED: "theme.openapi.request.connectionFailed",
32
- ERROR_TIMEOUT: "theme.openapi.request.error.timeout",
33
- ERROR_NETWORK: "theme.openapi.request.error.network",
34
- ERROR_CORS: "theme.openapi.request.error.cors",
35
- ERROR_UNKNOWN: "theme.openapi.request.error.unknown",
36
- };
37
-
38
- export const OPENAPI_SERVER = {
39
- EDIT_BUTTON: "theme.openapi.server.editButton",
40
- HIDE_BUTTON: "theme.openapi.server.hideButton",
41
- };
42
-
43
- export const OPENAPI_PARAM_OPTIONS = {
44
- SHOW_OPTIONAL: "theme.openapi.paramOptions.showOptional",
45
- HIDE_OPTIONAL: "theme.openapi.paramOptions.hideOptional",
46
- };
47
-
48
- export const OPENAPI_FORM_FILE_UPLOAD = {
49
- CLEAR_BUTTON: "theme.openapi.formFileUpload.clearButton",
50
- };
51
-
52
- export const OPENAPI_FORM = {
53
- FIELD_REQUIRED: "theme.openapi.form.fieldRequired",
54
- };
55
-
56
- export const OPENAPI_AUTH = {
57
- BEARER_TOKEN: "theme.openapi.auth.bearerToken",
58
- USERNAME: "theme.openapi.auth.username",
59
- PASSWORD: "theme.openapi.auth.password",
60
- SECURITY_SCHEME: "theme.openapi.auth.securityScheme",
61
- };
62
-
63
- export const OPENAPI_RESPONSE_EXAMPLES = {
64
- EXAMPLE: "theme.openapi.responseExamples.example",
65
- AUTO_EXAMPLE: "theme.openapi.responseExamples.autoExample",
66
- };
67
-
68
- export const OPENAPI_BODY = {
69
- EXAMPLE_FROM_SCHEMA: "theme.openapi.body.exampleFromSchema",
70
- };
71
-
72
- export const OPENAPI_STATUS_CODES = {
73
- RESPONSE_HEADERS: "theme.openapi.statusCodes.responseHeaders",
74
- SCHEMA_TITLE: "theme.openapi.statusCodes.schemaTitle",
75
- };
76
-
77
- export const OPENAPI_SCHEMA = {
78
- NO_SCHEMA: "theme.openapi.schema.noSchema",
79
- };
80
-
81
- export const OPENAPI_SCHEMA_EXPANSION = {
82
- BUTTON_LABEL: "theme.openapi.schema.expansion.button",
83
- MENU_LABEL: "theme.openapi.schema.expansion.menu",
84
- ALL: "theme.openapi.schema.expansion.all",
85
- DEPTH_OPTION: "theme.openapi.schema.expansion.depthOption",
86
- };
87
-
88
- export const OPENAPI_SCHEMA_ITEM = {
89
- CHARACTERS: "theme.openapi.schemaItem.characters",
90
- NON_EMPTY: "theme.openapi.schemaItem.nonEmpty",
91
- REQUIRED: "theme.openapi.schemaItem.required",
92
- DEPRECATED: "theme.openapi.schemaItem.deprecated",
93
- NULLABLE: "theme.openapi.schemaItem.nullable",
94
- DEFAULT_VALUE: "theme.openapi.schemaItem.defaultValue",
95
- EXAMPLE: "theme.openapi.schemaItem.example",
96
- EXAMPLES: "theme.openapi.schemaItem.examples",
97
- DESCRIPTION: "theme.openapi.schemaItem.description",
98
- CONSTANT_VALUE: "theme.openapi.schemaItem.constantValue",
99
- ENUM_VALUE: "theme.openapi.schemaItem.enumValue",
100
- ENUM_DESCRIPTION: "theme.openapi.schemaItem.enumDescription",
101
- POSSIBLE_VALUES: "theme.openapi.schemaItem.possibleValues",
102
- EXPRESSION: "theme.openapi.schemaItem.expression",
103
- ONE_OF: "theme.openapi.schemaItem.oneOf",
104
- ANY_OF: "theme.openapi.schemaItem.anyOf",
105
- };
106
-
107
- export const OPENAPI_PARAMS_DETAILS = {
108
- PARAMETERS_TITLE: "theme.openapi.paramsDetails.parametersTitle",
109
- };
8
+ /*
9
+ * The central dictionary of translation-id constants that used to live here
10
+ * (OPENAPI_REQUEST, OPENAPI_SCHEMA_ITEM, ...) has been removed. Each
11
+ * `translate({ id, message })` / `<Translate id="...">` call site now passes
12
+ * its id as an inline string literal instead.
13
+ *
14
+ * WHY THE DICTIONARY WAS REMOVED
15
+ * ------------------------------
16
+ * `docusaurus write-translations` only performs STATIC analysis of the source
17
+ * code (via @docusaurus/babel) — it never runs the site. To collect a string
18
+ * it evaluates the argument of every `translate()` / `<Translate>` call with
19
+ * Babel's `path.evaluate()` and keeps it only when the result is `confident`.
20
+ *
21
+ * An id referenced through an imported constant, e.g.
22
+ *
23
+ * import { OPENAPI_REQUEST } from "@theme/translationIds";
24
+ * translate({ id: OPENAPI_REQUEST.COLLAPSE_ALL, message: "Collapse all" });
25
+ *
26
+ * is a member expression on a binding imported from another module. Babel
27
+ * cannot statically resolve a cross-module binding, so `evaluate()` returns
28
+ * `confident === false`, the extractor skips the call (emitting a warning), and
29
+ * NOTHING is written to the locale `code.json`. As a result `write-translations`
30
+ * produced an empty template and downstream projects had no ids to translate,
31
+ * even though the strings rendered fine at runtime (the inlined constant value
32
+ * matched the runtime lookup key).
33
+ *
34
+ * The id and message must therefore be static string literals AT THE CALL SITE.
35
+ * This is the approach Docusaurus' own theme-classic uses and what its i18n
36
+ * guide mandates ("Text labels must be static"):
37
+ *
38
+ * - https://docusaurus.io/docs/i18n/tutorial#translate-your-react-code
39
+ * - https://docusaurus.io/docs/docusaurus-core#translate
40
+ *
41
+ * Keep this note here so the removal of the constants is discoverable; do not
42
+ * reintroduce a shared id dictionary for `translate()` arguments.
43
+ */
110
44
 
111
- export const OPENAPI_SECURITY_SCHEMES = {
112
- NAME: "theme.openapi.securitySchemes.name",
113
- TYPE: "theme.openapi.securitySchemes.type",
114
- SCOPES: "theme.openapi.securitySchemes.scopes",
115
- IN: "theme.openapi.securitySchemes.in",
116
- FLOWS: "theme.openapi.securitySchemes.flows",
117
- DESCRIPTION: "theme.openapi.securitySchemes.description",
118
- SCHEME: "theme.openapi.securitySchemes.scheme",
119
- BEARER_FORMAT: "theme.openapi.securitySchemes.bearerFormat",
120
- OPEN_ID_CONNECT_URL: "theme.openapi.securitySchemes.openIdConnectUrl",
121
- };
45
+ export {};