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

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 (45) hide show
  1. package/lib/markdown/schema.js +6 -1
  2. package/lib/theme/ApiExplorer/Authorization/index.js +6 -1
  3. package/lib/theme/ApiExplorer/CodeSnippets/index.js +2 -2
  4. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +3 -3
  5. package/lib/theme/ApiExplorer/CodeTabs/index.js +2 -2
  6. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +2 -0
  7. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +5 -4
  8. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +1 -2
  9. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +2 -3
  10. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +1 -1
  11. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +41 -50
  12. package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +17 -1
  13. package/lib/theme/ApiItem/Layout/index.d.ts +1 -1
  14. package/lib/theme/ApiItem/hooks.d.ts +9 -1
  15. package/lib/theme/ApiItem/store.d.ts +53 -5
  16. package/lib/theme/ParamsItem/index.js +9 -1
  17. package/lib/theme/RequestSchema/index.js +8 -2
  18. package/lib/theme/Schema/index.js +29 -6
  19. package/lib/theme/SchemaItem/index.js +9 -1
  20. package/lib/theme/translationIds.d.ts +10 -0
  21. package/lib/theme/translationIds.js +10 -0
  22. package/package.json +3 -3
  23. package/src/markdown/schema.ts +6 -1
  24. package/src/theme/ApiExplorer/Authorization/index.tsx +7 -2
  25. package/src/theme/ApiExplorer/Body/index.tsx +1 -1
  26. package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -0
  27. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +5 -5
  28. package/src/theme/ApiExplorer/CodeTabs/index.tsx +6 -5
  29. package/src/theme/ApiExplorer/ContentType/index.tsx +1 -1
  30. package/src/theme/ApiExplorer/FormTextInput/index.tsx +2 -0
  31. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +6 -5
  32. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +2 -3
  33. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +2 -3
  34. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +2 -2
  35. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +40 -50
  36. package/src/theme/ApiExplorer/Server/index.tsx +2 -2
  37. package/src/theme/ApiItem/Layout/index.tsx +1 -1
  38. package/src/theme/Markdown/index.d.ts +8 -0
  39. package/src/theme/ParamsItem/index.tsx +9 -1
  40. package/src/theme/RequestSchema/index.tsx +9 -3
  41. package/src/theme/Schema/index.tsx +34 -6
  42. package/src/theme/SchemaItem/index.tsx +9 -1
  43. package/src/theme/translationIds.ts +10 -0
  44. package/src/theme-openapi.d.ts +7 -275
  45. package/tsconfig.tsbuildinfo +1 -1
@@ -8,6 +8,8 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getSchemaName = getSchemaName;
10
10
  exports.getQualifierMessage = getQualifierMessage;
11
+ const Translate_1 = require("@docusaurus/Translate");
12
+ const translationIds_1 = require("../theme/translationIds");
11
13
  function prettyName(schema, circular) {
12
14
  if (schema.format) {
13
15
  return schema.format;
@@ -57,7 +59,10 @@ function getQualifierMessage(schema) {
57
59
  schema.maxItems === undefined) {
58
60
  return getQualifierMessage(schema.items);
59
61
  }
60
- let message = "**Possible values:** ";
62
+ let message = `**${(0, Translate_1.translate)({
63
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.POSSIBLE_VALUES,
64
+ message: "Possible values:",
65
+ })}** `;
61
66
  let qualifierGroups = [];
62
67
  if (schema.items && schema.items.enum) {
63
68
  if (schema.items.enum) {
@@ -39,7 +39,12 @@ function Authorization() {
39
39
  optionKeys.length > 1 &&
40
40
  react_1.default.createElement(
41
41
  FormItem_1.default,
42
- { label: "Security Scheme" },
42
+ {
43
+ label: (0, Translate_1.translate)({
44
+ id: translationIds_1.OPENAPI_AUTH.SECURITY_SCHEME,
45
+ message: "Security Scheme",
46
+ }),
47
+ },
43
48
  react_1.default.createElement(FormSelect_1.default, {
44
49
  options: optionKeys,
45
50
  value: selected,
@@ -325,7 +325,7 @@ function CodeSnippets({
325
325
  setSelectedSample: setSelectedSample,
326
326
  },
327
327
  includeSample: true,
328
- currentLanguage: lang.language,
328
+ currentLanguage: lang,
329
329
  defaultValue: selectedSample,
330
330
  languageSet: mergedLangs,
331
331
  lazy: true,
@@ -364,7 +364,7 @@ function CodeSnippets({
364
364
  setSelectedVariant: setSelectedVariant,
365
365
  },
366
366
  includeVariant: true,
367
- currentLanguage: lang.language,
367
+ currentLanguage: lang,
368
368
  defaultValue: selectedVariant,
369
369
  languageSet: mergedLangs,
370
370
  lazy: true,
@@ -1,13 +1,13 @@
1
1
  import React from "react";
2
2
  import { type TabProps } from "@docusaurus/theme-common/internal";
3
- import { Language } from "@theme/ApiExplorer/CodeSnippets";
3
+ import { Language } from "../CodeSnippets/code-snippets-types";
4
4
  export interface Props {
5
5
  action: {
6
6
  [key: string]: React.Dispatch<any>;
7
7
  };
8
- currentLanguage: Language;
8
+ currentLanguage?: Language;
9
9
  languageSet: Language[];
10
- includeVariant: boolean;
10
+ includeVariant?: boolean;
11
11
  }
12
12
  export interface CodeTabsProps extends Props, TabProps {
13
13
  includeSample?: boolean;
@@ -122,13 +122,13 @@ function TabList({
122
122
  let newLanguage;
123
123
  if (currentLanguage && includeVariant) {
124
124
  newLanguage = languageSet.filter(
125
- (lang) => lang.language === currentLanguage
125
+ (lang) => lang.language === currentLanguage.language
126
126
  )[0];
127
127
  newLanguage.variant = newTabValue;
128
128
  action.setSelectedVariant(newTabValue.toLowerCase());
129
129
  } else if (currentLanguage && includeSample) {
130
130
  newLanguage = languageSet.filter(
131
- (lang) => lang.language === currentLanguage
131
+ (lang) => lang.language === currentLanguage.language
132
132
  )[0];
133
133
  newLanguage.sample = newTabValue;
134
134
  action.setSelectedSample(newTabValue);
@@ -4,6 +4,8 @@ export interface Props {
4
4
  placeholder?: string;
5
5
  password?: boolean;
6
6
  onChange?: React.ChangeEventHandler<HTMLInputElement>;
7
+ paramName?: string;
8
+ isRequired?: boolean;
7
9
  }
8
10
  declare function FormTextInput({ isRequired, value, placeholder, password, onChange, paramName, }: Props): React.JSX.Element;
9
11
  export default FormTextInput;
@@ -128,14 +128,15 @@ function ParamArrayFormItem({ param }) {
128
128
  // eslint-disable-next-line react-hooks/exhaustive-deps
129
129
  }, [items]);
130
130
  (0, react_1.useEffect)(() => {
131
- if (param.schema?.example?.length > 0) {
132
- const examplesWithIds = param.schema.example.map((item) => ({
131
+ const example = param.schema?.example;
132
+ if (Array.isArray(example) && example.length > 0) {
133
+ const examplesWithIds = example.map((item) => ({
133
134
  id: (0, toolkit_1.nanoid)(),
134
135
  value: item.toString(),
135
136
  }));
136
137
  setItems(examplesWithIds);
137
138
  }
138
- }, [param.schema.example, param.schema.length]);
139
+ }, [param.schema?.example]);
139
140
  function handleDeleteItem(itemToDelete) {
140
141
  return () => {
141
142
  const newItems = items.filter((i) => i.id !== itemToDelete.id);
@@ -168,7 +169,7 @@ function ParamArrayFormItem({ param }) {
168
169
  : false,
169
170
  },
170
171
  name: "paramArray",
171
- render: ({ field: { onChange, name } }) =>
172
+ render: ({ field: { onChange } }) =>
172
173
  react_1.default.createElement(
173
174
  react_1.default.Fragment,
174
175
  null,
@@ -41,9 +41,8 @@ function ParamBooleanFormItem({ param }) {
41
41
  : false,
42
42
  },
43
43
  name: "paramBoolean",
44
- render: ({ field: { onChange, name } }) =>
44
+ render: ({ field: { onChange } }) =>
45
45
  react_1.default.createElement(FormSelect_1.default, {
46
- name: name,
47
46
  options: ["---", "true", "false"],
48
47
  onChange: (e) => {
49
48
  const val = e.target.value;
@@ -75,12 +75,11 @@ function ParamMultiSelectFormItem({ param }) {
75
75
  : false,
76
76
  },
77
77
  name: "paramMultiSelect",
78
- render: ({ field: { onChange, name } }) =>
78
+ render: ({ field: { onChange } }) =>
79
79
  react_1.default.createElement(FormMultiSelect_1.default, {
80
80
  options: options,
81
- name: name,
82
81
  onChange: (e) => handleChange(e, onChange),
83
- showErrors: showErrorMessage,
82
+ showErrors: !!showErrorMessage,
84
83
  }),
85
84
  }),
86
85
  showErrorMessage &&
@@ -42,7 +42,7 @@ function ParamSelectFormItem({ param }) {
42
42
  : false,
43
43
  },
44
44
  name: "paramSelect",
45
- render: ({ field: { onChange, name } }) =>
45
+ render: ({ field: { onChange } }) =>
46
46
  react_1.default.createElement(FormSelect_1.default, {
47
47
  options: ["---", ...options],
48
48
  onChange: (e) => {
@@ -27,6 +27,42 @@ function SecuritySchemes(props) {
27
27
  return null;
28
28
  }
29
29
  const selectedAuth = options[selected];
30
+ const keyTranslations = {
31
+ description: {
32
+ id: translationIds_1.OPENAPI_SECURITY_SCHEMES.DESCRIPTION,
33
+ message: "description:",
34
+ },
35
+ scheme: {
36
+ id: translationIds_1.OPENAPI_SECURITY_SCHEMES.SCHEME,
37
+ message: "scheme:",
38
+ },
39
+ bearerFormat: {
40
+ id: translationIds_1.OPENAPI_SECURITY_SCHEMES.BEARER_FORMAT,
41
+ message: "bearerFormat:",
42
+ },
43
+ openIdConnectUrl: {
44
+ id: translationIds_1.OPENAPI_SECURITY_SCHEMES.OPEN_ID_CONNECT_URL,
45
+ message: "openIdConnectUrl:",
46
+ },
47
+ };
48
+ const renderRest = (rest) =>
49
+ Object.keys(rest).map((k) => {
50
+ const translation = keyTranslations[k];
51
+ const label = translation
52
+ ? (0, Translate_1.translate)({
53
+ id: translation.id,
54
+ message: translation.message,
55
+ })
56
+ : `${k}:`;
57
+ return react_1.default.createElement(
58
+ "span",
59
+ { key: k },
60
+ react_1.default.createElement("strong", null, label, " "),
61
+ typeof rest[k] === "object"
62
+ ? JSON.stringify(rest[k], null, 2)
63
+ : String(rest[k])
64
+ );
65
+ });
30
66
  return react_1.default.createElement(
31
67
  "details",
32
68
  { className: "openapi-security__details", open: false },
@@ -112,16 +148,7 @@ function SecuritySchemes(props) {
112
148
  auth.scopes.length > 0 ? auth.scopes.toString() : "[]"
113
149
  )
114
150
  ),
115
- Object.keys(rest).map((k, i) => {
116
- return react_1.default.createElement(
117
- "span",
118
- { key: k },
119
- react_1.default.createElement("strong", null, k, ": "),
120
- typeof rest[k] === "object"
121
- ? JSON.stringify(rest[k], null, 2)
122
- : String(rest[k])
123
- );
124
- })
151
+ renderRest(rest)
125
152
  )
126
153
  );
127
154
  }
@@ -191,16 +218,7 @@ function SecuritySchemes(props) {
191
218
  auth.scopes.length > 0 ? auth.scopes.toString() : "[]"
192
219
  )
193
220
  ),
194
- Object.keys(rest).map((k, i) => {
195
- return react_1.default.createElement(
196
- "span",
197
- { key: k },
198
- react_1.default.createElement("strong", null, k, ": "),
199
- typeof rest[k] === "object"
200
- ? JSON.stringify(rest[k], null, 2)
201
- : String(rest[k])
202
- );
203
- })
221
+ renderRest(rest)
204
222
  )
205
223
  );
206
224
  }
@@ -331,16 +349,7 @@ function SecuritySchemes(props) {
331
349
  auth.scopes.length > 0 ? auth.scopes.toString() : "[]"
332
350
  )
333
351
  ),
334
- Object.keys(rest).map((k, i) => {
335
- return react_1.default.createElement(
336
- "span",
337
- { key: k },
338
- react_1.default.createElement("strong", null, k, ": "),
339
- typeof rest[k] === "object"
340
- ? JSON.stringify(rest[k], null, 2)
341
- : String(rest[k])
342
- );
343
- })
352
+ renderRest(rest)
344
353
  )
345
354
  );
346
355
  }
@@ -410,16 +419,7 @@ function SecuritySchemes(props) {
410
419
  auth.scopes.length > 0 ? auth.scopes.toString() : "[]"
411
420
  )
412
421
  ),
413
- Object.keys(rest).map((k, i) => {
414
- return react_1.default.createElement(
415
- "span",
416
- { key: k },
417
- react_1.default.createElement("strong", null, k, ": "),
418
- typeof rest[k] === "object"
419
- ? JSON.stringify(rest[k], null, 2)
420
- : String(rest[k])
421
- );
422
- }),
422
+ renderRest(rest),
423
423
  flows &&
424
424
  react_1.default.createElement(
425
425
  "span",
@@ -508,16 +508,7 @@ function SecuritySchemes(props) {
508
508
  auth.scopes.length > 0 ? auth.scopes.toString() : "[]"
509
509
  )
510
510
  ),
511
- Object.keys(rest).map((k, i) => {
512
- return react_1.default.createElement(
513
- "span",
514
- { key: k },
515
- react_1.default.createElement("strong", null, k, ": "),
516
- typeof rest[k] === "object"
517
- ? JSON.stringify(rest[k], null, 2)
518
- : String(rest[k])
519
- );
520
- })
511
+ renderRest(rest)
521
512
  )
522
513
  );
523
514
  }
@@ -1,3 +1,19 @@
1
1
  import { Middleware } from "@reduxjs/toolkit";
2
2
  import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
3
- export declare function createPersistanceMiddleware(options: ThemeConfig["api"]): Middleware<{}, RootState, AppDispatch>;
3
+ export declare function createPersistanceMiddleware(options: ThemeConfig["api"]): Middleware<{}, {
4
+ accept: import("./Accept/slice").State;
5
+ contentType: import("./ContentType/slice").State;
6
+ response: import("./Response/slice").State;
7
+ server: import("./Server/slice").State;
8
+ body: import("./Body/slice").FormBody | import("./Body/slice").RawBody | import("./Body/slice").EmptyBody;
9
+ params: import("./ParamOptions/slice").State;
10
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
11
+ }, import("redux-thunk").ThunkDispatch<{
12
+ accept: import("./Accept/slice").State;
13
+ contentType: import("./ContentType/slice").State;
14
+ response: import("./Response/slice").State;
15
+ server: import("./Server/slice").State;
16
+ body: import("./Body/slice").FormBody | import("./Body/slice").RawBody | import("./Body/slice").EmptyBody;
17
+ params: import("./ParamOptions/slice").State;
18
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
19
+ }, undefined, import("redux").UnknownAction> & import("redux").Dispatch<import("redux").UnknownAction>>;
@@ -1,3 +1,3 @@
1
1
  import { type JSX } from "react";
2
- import type { Props } from "@theme/ApiItem/Layout";
2
+ import type { Props } from "@theme/DocItem/Layout";
3
3
  export default function DocItemLayout({ children }: Props): JSX.Element;
@@ -1,4 +1,12 @@
1
1
  import { TypedUseSelectorHook } from "react-redux";
2
2
  import type { RootState } from "./store";
3
- export declare const useTypedDispatch: () => import("redux-thunk").ThunkDispatch<any, undefined, import("redux").UnknownAction> & import("redux").Dispatch<import("redux").UnknownAction>;
3
+ export declare const useTypedDispatch: () => import("redux-thunk").ThunkDispatch<{
4
+ accept: import("../ApiExplorer/Accept/slice").State;
5
+ contentType: import("../ApiExplorer/ContentType/slice").State;
6
+ response: import("../ApiExplorer/Response/slice").State;
7
+ server: import("../ApiExplorer/Server/slice").State;
8
+ body: import("../ApiExplorer/Body/slice").FormBody | import("../ApiExplorer/Body/slice").RawBody | import("../ApiExplorer/Body/slice").EmptyBody;
9
+ params: import("../ApiExplorer/ParamOptions/slice").State;
10
+ auth: import("../ApiExplorer/Authorization/slice").AuthState;
11
+ }, undefined, import("redux").UnknownAction> & import("redux").Dispatch<import("redux").UnknownAction>;
4
12
  export declare const useTypedSelector: TypedUseSelectorHook<RootState>;
@@ -1,10 +1,58 @@
1
- declare const rootReducer: any;
1
+ declare const rootReducer: import("redux").Reducer<{
2
+ accept: import("@theme/ApiExplorer/Accept/slice").State;
3
+ contentType: import("@theme/ApiExplorer/ContentType/slice").State;
4
+ response: import("@theme/ApiExplorer/Response/slice").State;
5
+ server: import("@theme/ApiExplorer/Server/slice").State;
6
+ body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
7
+ params: import("@theme/ApiExplorer/ParamOptions/slice").State;
8
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
9
+ }, import("redux").UnknownAction, Partial<{
10
+ accept: import("@theme/ApiExplorer/Accept/slice").State | undefined;
11
+ contentType: import("@theme/ApiExplorer/ContentType/slice").State | undefined;
12
+ response: import("@theme/ApiExplorer/Response/slice").State | undefined;
13
+ server: import("@theme/ApiExplorer/Server/slice").State | undefined;
14
+ body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody | undefined;
15
+ params: import("@theme/ApiExplorer/ParamOptions/slice").State | undefined;
16
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState | undefined;
17
+ }>>;
2
18
  export type RootState = ReturnType<typeof rootReducer>;
3
- export declare const createStoreWithState: (preloadedState: RootState, middlewares: any[]) => import("@reduxjs/toolkit").EnhancedStore<any, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
4
- dispatch: import("redux-thunk").ThunkDispatch<any, undefined, import("redux").UnknownAction>;
19
+ export declare const createStoreWithState: (preloadedState: RootState, middlewares: any[]) => import("@reduxjs/toolkit").EnhancedStore<{
20
+ accept: import("@theme/ApiExplorer/Accept/slice").State;
21
+ contentType: import("@theme/ApiExplorer/ContentType/slice").State;
22
+ response: import("@theme/ApiExplorer/Response/slice").State;
23
+ server: import("@theme/ApiExplorer/Server/slice").State;
24
+ body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
25
+ params: import("@theme/ApiExplorer/ParamOptions/slice").State;
26
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
27
+ }, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
28
+ dispatch: import("redux-thunk").ThunkDispatch<{
29
+ accept: import("@theme/ApiExplorer/Accept/slice").State;
30
+ contentType: import("@theme/ApiExplorer/ContentType/slice").State;
31
+ response: import("@theme/ApiExplorer/Response/slice").State;
32
+ server: import("@theme/ApiExplorer/Server/slice").State;
33
+ body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
34
+ params: import("@theme/ApiExplorer/ParamOptions/slice").State;
35
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
36
+ }, undefined, import("redux").UnknownAction>;
5
37
  }>, import("redux").StoreEnhancer]>>;
6
- export declare const createStoreWithoutState: (preloadedState: {}, middlewares: any[]) => import("@reduxjs/toolkit").EnhancedStore<any, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
7
- dispatch: import("redux-thunk").ThunkDispatch<any, undefined, import("redux").UnknownAction>;
38
+ export declare const createStoreWithoutState: (preloadedState: {}, middlewares: any[]) => import("@reduxjs/toolkit").EnhancedStore<{
39
+ accept: import("@theme/ApiExplorer/Accept/slice").State;
40
+ contentType: import("@theme/ApiExplorer/ContentType/slice").State;
41
+ response: import("@theme/ApiExplorer/Response/slice").State;
42
+ server: import("@theme/ApiExplorer/Server/slice").State;
43
+ body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
44
+ params: import("@theme/ApiExplorer/ParamOptions/slice").State;
45
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
46
+ }, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
47
+ dispatch: import("redux-thunk").ThunkDispatch<{
48
+ accept: import("@theme/ApiExplorer/Accept/slice").State;
49
+ contentType: import("@theme/ApiExplorer/ContentType/slice").State;
50
+ response: import("@theme/ApiExplorer/Response/slice").State;
51
+ server: import("@theme/ApiExplorer/Server/slice").State;
52
+ body: import("@theme/ApiExplorer/Body/slice").FormBody | import("@theme/ApiExplorer/Body/slice").RawBody | import("@theme/ApiExplorer/Body/slice").EmptyBody;
53
+ params: import("@theme/ApiExplorer/ParamOptions/slice").State;
54
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
55
+ }, undefined, import("redux").UnknownAction>;
8
56
  }>, import("redux").StoreEnhancer]>>;
9
57
  export type AppDispatch = ReturnType<typeof createStoreWithState>["dispatch"];
10
58
  export {};
@@ -23,7 +23,15 @@ const schema_1 = require("../../markdown/schema");
23
23
  const utils_1 = require("../../markdown/utils");
24
24
  const getEnumDescriptionMarkdown = (enumDescriptions) => {
25
25
  if (enumDescriptions?.length) {
26
- return `| Enum Value | Description |
26
+ const enumValue = (0, Translate_1.translate)({
27
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_VALUE,
28
+ message: "Enum Value",
29
+ });
30
+ const description = (0, Translate_1.translate)({
31
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_DESCRIPTION,
32
+ message: "Description",
33
+ });
34
+ return `| ${enumValue} | ${description} |
27
35
  | ---- | ----- |
28
36
  ${enumDescriptions
29
37
  .map((desc) => {
@@ -68,7 +68,10 @@ const RequestSchemaComponent = ({ title, body, style }) => {
68
68
  className:
69
69
  "openapi-markdown__details-summary-header-body",
70
70
  },
71
- title,
71
+ (0, Translate_1.translate)({
72
+ id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
73
+ message: title,
74
+ }),
72
75
  body.required === true &&
73
76
  react_1.default.createElement(
74
77
  "span",
@@ -138,7 +141,10 @@ const RequestSchemaComponent = ({ title, body, style }) => {
138
141
  react_1.default.createElement(
139
142
  "h3",
140
143
  { className: "openapi-markdown__details-summary-header-body" },
141
- title,
144
+ (0, Translate_1.translate)({
145
+ id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
146
+ message: title,
147
+ }),
142
148
  firstBody.type === "array" &&
143
149
  react_1.default.createElement(
144
150
  "span",
@@ -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 ArrayBrackets_1 = require("@theme/ArrayBrackets");
16
18
  const Details_1 = __importDefault(require("@theme/Details"));
17
19
  const DiscriminatorTabs_1 = __importDefault(
@@ -77,25 +79,43 @@ const Summary = ({ name, schemaName, schema, required }) => {
77
79
  react_1.default.createElement(
78
80
  "span",
79
81
  { className: "openapi-schema__nullable" },
80
- "nullable"
82
+ (0, Translate_1.translate)({
83
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.NULLABLE,
84
+ message: "nullable",
85
+ })
81
86
  ),
82
87
  isRequired &&
83
88
  react_1.default.createElement(
84
89
  "span",
85
90
  { className: "openapi-schema__required" },
86
- "required"
91
+ (0, Translate_1.translate)({
92
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
93
+ message: "required",
94
+ })
87
95
  ),
88
96
  deprecated &&
89
97
  react_1.default.createElement(
90
98
  "span",
91
99
  { className: "openapi-schema__deprecated" },
92
- "deprecated"
100
+ (0, Translate_1.translate)({
101
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEPRECATED,
102
+ message: "deprecated",
103
+ })
93
104
  )
94
105
  )
95
106
  );
96
107
  };
97
108
  const AnyOneOf = ({ schema, schemaType }) => {
98
- const type = schema.oneOf ? "oneOf" : "anyOf";
109
+ const key = schema.oneOf ? "oneOf" : "anyOf";
110
+ const type = schema.oneOf
111
+ ? (0, Translate_1.translate)({
112
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.ONE_OF,
113
+ message: "oneOf",
114
+ })
115
+ : (0, Translate_1.translate)({
116
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.ANY_OF,
117
+ message: "anyOf",
118
+ });
99
119
  return react_1.default.createElement(
100
120
  react_1.default.Fragment,
101
121
  null,
@@ -107,7 +127,7 @@ const AnyOneOf = ({ schema, schemaType }) => {
107
127
  react_1.default.createElement(
108
128
  SchemaTabs_1.default,
109
129
  null,
110
- schema[type]?.map((anyOneSchema, index) => {
130
+ schema[key]?.map((anyOneSchema, index) => {
111
131
  const label = anyOneSchema.title || anyOneSchema.type;
112
132
  return (
113
133
  // @ts-ignore
@@ -262,7 +282,10 @@ const PropertyDiscriminator = ({
262
282
  react_1.default.createElement(
263
283
  "span",
264
284
  { className: "openapi-schema__required" },
265
- "required"
285
+ (0, Translate_1.translate)({
286
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
287
+ message: "required",
288
+ })
266
289
  )
267
290
  ),
268
291
  react_1.default.createElement(
@@ -26,7 +26,15 @@ const transformEnumDescriptions = (enumDescriptions) => {
26
26
  };
27
27
  const getEnumDescriptionMarkdown = (enumDescriptions) => {
28
28
  if (enumDescriptions?.length) {
29
- return `| Enum Value | Description |
29
+ const enumValue = (0, Translate_1.translate)({
30
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_VALUE,
31
+ message: "Enum Value",
32
+ });
33
+ const description = (0, Translate_1.translate)({
34
+ id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_DESCRIPTION,
35
+ message: "Description",
36
+ });
37
+ return `| ${enumValue} | ${description} |
30
38
  | ---- | ----- |
31
39
  ${enumDescriptions
32
40
  .map((desc) => {
@@ -39,6 +39,7 @@ export declare const OPENAPI_AUTH: {
39
39
  BEARER_TOKEN: string;
40
40
  USERNAME: string;
41
41
  PASSWORD: string;
42
+ SECURITY_SCHEME: string;
42
43
  };
43
44
  export declare const OPENAPI_RESPONSE_EXAMPLES: {
44
45
  EXAMPLE: string;
@@ -60,6 +61,11 @@ export declare const OPENAPI_SCHEMA_ITEM: {
60
61
  EXAMPLES: string;
61
62
  DESCRIPTION: string;
62
63
  CONSTANT_VALUE: string;
64
+ ENUM_VALUE: string;
65
+ ENUM_DESCRIPTION: string;
66
+ POSSIBLE_VALUES: string;
67
+ ONE_OF: string;
68
+ ANY_OF: string;
63
69
  };
64
70
  export declare const OPENAPI_PARAMS_DETAILS: {
65
71
  PARAMETERS_TITLE: string;
@@ -70,4 +76,8 @@ export declare const OPENAPI_SECURITY_SCHEMES: {
70
76
  SCOPES: string;
71
77
  IN: string;
72
78
  FLOWS: string;
79
+ DESCRIPTION: string;
80
+ SCHEME: string;
81
+ BEARER_FORMAT: string;
82
+ OPEN_ID_CONNECT_URL: string;
73
83
  };
@@ -62,6 +62,7 @@ exports.OPENAPI_AUTH = {
62
62
  BEARER_TOKEN: "theme.openapi.auth.bearerToken",
63
63
  USERNAME: "theme.openapi.auth.username",
64
64
  PASSWORD: "theme.openapi.auth.password",
65
+ SECURITY_SCHEME: "theme.openapi.auth.securityScheme",
65
66
  };
66
67
  exports.OPENAPI_RESPONSE_EXAMPLES = {
67
68
  EXAMPLE: "theme.openapi.responseExamples.example",
@@ -83,6 +84,11 @@ exports.OPENAPI_SCHEMA_ITEM = {
83
84
  EXAMPLES: "theme.openapi.schemaItem.examples",
84
85
  DESCRIPTION: "theme.openapi.schemaItem.description",
85
86
  CONSTANT_VALUE: "theme.openapi.schemaItem.constantValue",
87
+ ENUM_VALUE: "theme.openapi.schemaItem.enumValue",
88
+ ENUM_DESCRIPTION: "theme.openapi.schemaItem.enumDescription",
89
+ POSSIBLE_VALUES: "theme.openapi.schemaItem.possibleValues",
90
+ ONE_OF: "theme.openapi.schemaItem.oneOf",
91
+ ANY_OF: "theme.openapi.schemaItem.anyOf",
86
92
  };
87
93
  exports.OPENAPI_PARAMS_DETAILS = {
88
94
  PARAMETERS_TITLE: "theme.openapi.paramsDetails.parametersTitle",
@@ -93,4 +99,8 @@ exports.OPENAPI_SECURITY_SCHEMES = {
93
99
  SCOPES: "theme.openapi.securitySchemes.scopes",
94
100
  IN: "theme.openapi.securitySchemes.in",
95
101
  FLOWS: "theme.openapi.securitySchemes.flows",
102
+ DESCRIPTION: "theme.openapi.securitySchemes.description",
103
+ SCHEME: "theme.openapi.securitySchemes.scheme",
104
+ BEARER_FORMAT: "theme.openapi.securitySchemes.bearerFormat",
105
+ OPEN_ID_CONNECT_URL: "theme.openapi.securitySchemes.openIdConnectUrl",
96
106
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-1055",
4
+ "version": "0.0.0-1068",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -38,7 +38,7 @@
38
38
  "@types/postman-collection": "^3.5.11",
39
39
  "@types/react-modal": "^3.16.3",
40
40
  "concurrently": "^9.2.0",
41
- "docusaurus-plugin-openapi-docs": "0.0.0-1055",
41
+ "docusaurus-plugin-openapi-docs": "0.0.0-1068",
42
42
  "docusaurus-plugin-sass": "^0.2.6",
43
43
  "eslint-plugin-prettier": "^5.5.1"
44
44
  },
@@ -81,5 +81,5 @@
81
81
  "engines": {
82
82
  "node": ">=14"
83
83
  },
84
- "gitHead": "032eb64b64b19ba5d04fad6c1dcfaa2a96952f71"
84
+ "gitHead": "d18835ed938d31e72d4c57d272902a3818eac708"
85
85
  }
@@ -5,6 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
+ import { translate } from "@docusaurus/Translate";
9
+ import { OPENAPI_SCHEMA_ITEM } from "../theme/translationIds";
8
10
  import { SchemaObject } from "../types";
9
11
 
10
12
  function prettyName(schema: SchemaObject, circular?: boolean) {
@@ -72,7 +74,10 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
72
74
  return getQualifierMessage(schema.items);
73
75
  }
74
76
 
75
- let message = "**Possible values:** ";
77
+ let message = `**${translate({
78
+ id: OPENAPI_SCHEMA_ITEM.POSSIBLE_VALUES,
79
+ message: "Possible values:",
80
+ })}** `;
76
81
 
77
82
  let qualifierGroups = [];
78
83