docusaurus-theme-openapi-docs 4.5.0 → 4.6.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.
- package/lib/markdown/schema.js +9 -1
- package/lib/theme/ApiExplorer/Accept/slice.d.ts +5 -2
- package/lib/theme/ApiExplorer/Authorization/index.js +50 -9
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +145 -3
- package/lib/theme/ApiExplorer/Authorization/slice.js +3 -1
- package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.js +126 -0
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +110 -0
- package/lib/theme/ApiExplorer/Body/index.js +94 -100
- package/lib/theme/ApiExplorer/Body/slice.d.ts +1056 -11
- package/lib/theme/ApiExplorer/Body/slice.js +22 -2
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +37 -26
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +5 -1
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +3 -3
- package/lib/theme/ApiExplorer/CodeTabs/index.js +2 -2
- package/lib/theme/ApiExplorer/ContentType/slice.d.ts +5 -2
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +6 -1
- package/lib/theme/ApiExplorer/FormItem/index.js +6 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +2 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.js +8 -1
- package/lib/theme/ApiExplorer/LiveEditor/index.js +11 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +15 -5
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +11 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +12 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +11 -2
- package/lib/theme/ApiExplorer/ParamOptions/index.js +11 -1
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +0 -4
- package/lib/theme/ApiExplorer/ParamOptions/slice.js +4 -4
- package/lib/theme/ApiExplorer/Request/index.js +110 -17
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +7 -1
- package/lib/theme/ApiExplorer/Request/makeRequest.js +94 -24
- package/lib/theme/ApiExplorer/Response/index.js +34 -14
- package/lib/theme/ApiExplorer/Response/slice.d.ts +31 -7
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +208 -69
- package/lib/theme/ApiExplorer/Server/index.js +16 -2
- package/lib/theme/ApiExplorer/Server/slice.d.ts +49 -3
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +46 -57
- package/lib/theme/ApiExplorer/index.js +11 -1
- package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +19 -0
- package/lib/theme/ApiExplorer/{persistanceMiddleware.js → persistenceMiddleware.js} +16 -9
- package/lib/theme/ApiExplorer/storage-utils.d.ts +2 -2
- package/lib/theme/ApiExplorer/storage-utils.js +3 -3
- package/lib/theme/ApiItem/Layout/index.d.ts +1 -1
- package/lib/theme/ApiItem/hooks.d.ts +9 -9
- package/lib/theme/ApiItem/index.js +12 -8
- package/lib/theme/ApiItem/store.d.ts +55 -43
- package/lib/theme/ApiTabs/index.js +6 -1
- package/lib/theme/Example/_Example.scss +11 -0
- package/lib/theme/Example/index.d.ts +24 -0
- package/lib/theme/Example/index.js +170 -0
- package/lib/theme/ParamsDetails/index.js +9 -1
- package/lib/theme/ParamsItem/index.d.ts +1 -1
- package/lib/theme/ParamsItem/index.js +43 -74
- package/lib/theme/RequestSchema/index.js +18 -4
- package/lib/theme/ResponseExamples/index.js +23 -3
- package/lib/theme/ResponseSchema/index.js +97 -82
- package/lib/theme/Schema/index.js +106 -23
- package/lib/theme/SchemaItem/index.js +64 -36
- package/lib/theme/SchemaTabs/index.js +4 -1
- package/lib/theme/StatusCodes/index.js +11 -2
- package/lib/theme/styles.scss +5 -0
- package/lib/theme/translationIds.d.ts +90 -0
- package/lib/theme/translationIds.js +114 -0
- package/lib/types.d.ts +9 -1
- package/package.json +28 -28
- package/src/markdown/schema.ts +11 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +51 -10
- package/src/theme/ApiExplorer/Authorization/slice.ts +1 -1
- package/src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx +77 -0
- package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +120 -0
- package/src/theme/ApiExplorer/Body/index.tsx +87 -107
- package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -0
- package/src/theme/ApiExplorer/Body/slice.ts +40 -1
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +43 -29
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +5 -1
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +6 -5
- package/src/theme/ApiExplorer/ContentType/index.tsx +1 -1
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +6 -1
- package/src/theme/ApiExplorer/FormItem/index.tsx +8 -1
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +10 -1
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +11 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +16 -6
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +12 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +12 -3
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +10 -2
- package/src/theme/ApiExplorer/ParamOptions/slice.ts +1 -1
- package/src/theme/ApiExplorer/Request/index.tsx +108 -17
- package/src/theme/ApiExplorer/Request/makeRequest.ts +106 -25
- package/src/theme/ApiExplorer/Response/index.tsx +30 -8
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +157 -69
- package/src/theme/ApiExplorer/Server/index.tsx +12 -4
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +47 -63
- package/src/theme/ApiExplorer/index.tsx +10 -1
- package/src/theme/ApiExplorer/{persistanceMiddleware.ts → persistenceMiddleware.ts} +23 -13
- package/src/theme/ApiExplorer/storage-utils.ts +4 -4
- package/src/theme/ApiItem/Layout/index.tsx +1 -1
- package/src/theme/ApiItem/index.tsx +12 -7
- package/src/theme/ApiTabs/index.tsx +6 -1
- package/src/theme/Example/_Example.scss +11 -0
- package/src/theme/Example/index.tsx +168 -0
- package/src/theme/Markdown/index.d.ts +8 -0
- package/src/theme/ParamsDetails/index.tsx +10 -1
- package/src/theme/ParamsItem/index.tsx +38 -54
- package/src/theme/RequestSchema/index.tsx +19 -4
- package/src/theme/ResponseExamples/index.tsx +23 -3
- package/src/theme/ResponseSchema/index.tsx +73 -61
- package/src/theme/Schema/index.tsx +128 -33
- package/src/theme/SchemaItem/index.tsx +51 -33
- package/src/theme/SchemaTabs/index.tsx +4 -1
- package/src/theme/StatusCodes/index.tsx +13 -2
- package/src/theme/styles.scss +5 -0
- package/src/theme/translationIds.ts +111 -0
- package/src/theme-openapi.d.ts +7 -275
- package/src/types.ts +9 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +0 -3
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault =
|
|
9
|
+
(this && this.__importDefault) ||
|
|
10
|
+
function (mod) {
|
|
11
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.renderExamplesRecord = exports.Example = void 0;
|
|
15
|
+
exports.renderStringArrayExamples = renderStringArrayExamples;
|
|
16
|
+
const react_1 = __importDefault(require("react"));
|
|
17
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
18
|
+
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
19
|
+
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
20
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
21
|
+
const EXAMPLE_CLASS_NAME = "openapi-example";
|
|
22
|
+
const EXAMPLES_CLASS_NAME = "openapi-examples";
|
|
23
|
+
/**
|
|
24
|
+
* Example Component
|
|
25
|
+
*/
|
|
26
|
+
const Example = ({ example, examples }) => {
|
|
27
|
+
if (example !== undefined) {
|
|
28
|
+
return renderExample(example);
|
|
29
|
+
}
|
|
30
|
+
if (examples !== undefined) {
|
|
31
|
+
return renderExamples(examples);
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
exports.Example = Example;
|
|
36
|
+
/**
|
|
37
|
+
* Format example value
|
|
38
|
+
*
|
|
39
|
+
* @param example
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
const formatExample = (example) => {
|
|
43
|
+
if (typeof example === "object" && example !== null) {
|
|
44
|
+
return JSON.stringify(example);
|
|
45
|
+
}
|
|
46
|
+
return String(example);
|
|
47
|
+
};
|
|
48
|
+
const renderExample = (example) => {
|
|
49
|
+
return react_1.default.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{ className: EXAMPLE_CLASS_NAME },
|
|
52
|
+
react_1.default.createElement(
|
|
53
|
+
"strong",
|
|
54
|
+
null,
|
|
55
|
+
(0, Translate_1.translate)({
|
|
56
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.EXAMPLE,
|
|
57
|
+
message: "Example:",
|
|
58
|
+
}),
|
|
59
|
+
" "
|
|
60
|
+
),
|
|
61
|
+
react_1.default.createElement(
|
|
62
|
+
"span",
|
|
63
|
+
null,
|
|
64
|
+
react_1.default.createElement("code", null, formatExample(example))
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
const renderExamples = (examples) => {
|
|
69
|
+
if (Array.isArray(examples)) {
|
|
70
|
+
return renderStringArrayExamples(examples);
|
|
71
|
+
}
|
|
72
|
+
return (0, exports.renderExamplesRecord)(examples);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Render string examples
|
|
76
|
+
*
|
|
77
|
+
* @param examples
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
function renderStringArrayExamples(examples) {
|
|
81
|
+
if (examples.length === 0) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
// If there's only one example, display it without tabs
|
|
85
|
+
if (examples.length === 1) {
|
|
86
|
+
return renderExample(examples[0]);
|
|
87
|
+
}
|
|
88
|
+
// Multiple examples - use tabs
|
|
89
|
+
const exampleEntries = examples.reduce(
|
|
90
|
+
(acc, example, index) => ({
|
|
91
|
+
...acc,
|
|
92
|
+
[`Example ${index + 1}`]: {
|
|
93
|
+
value: example,
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
{}
|
|
97
|
+
);
|
|
98
|
+
return (0, exports.renderExamplesRecord)(exampleEntries);
|
|
99
|
+
}
|
|
100
|
+
const renderExamplesRecord = (examples) => {
|
|
101
|
+
const exampleEntries = Object.entries(examples);
|
|
102
|
+
// If there's only one example, display it without tabs
|
|
103
|
+
if (exampleEntries.length === 1) {
|
|
104
|
+
const firstExample = exampleEntries[0][1];
|
|
105
|
+
if (!firstExample) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
return renderExample(firstExample.value);
|
|
109
|
+
}
|
|
110
|
+
return react_1.default.createElement(
|
|
111
|
+
"div",
|
|
112
|
+
{ className: EXAMPLES_CLASS_NAME },
|
|
113
|
+
react_1.default.createElement(
|
|
114
|
+
"strong",
|
|
115
|
+
null,
|
|
116
|
+
(0, Translate_1.translate)({
|
|
117
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.EXAMPLES,
|
|
118
|
+
message: "Examples:",
|
|
119
|
+
})
|
|
120
|
+
),
|
|
121
|
+
react_1.default.createElement(
|
|
122
|
+
SchemaTabs_1.default,
|
|
123
|
+
null,
|
|
124
|
+
exampleEntries.map(([exampleName, exampleProperties]) =>
|
|
125
|
+
renderExampleObject(exampleName, exampleProperties)
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
exports.renderExamplesRecord = renderExamplesRecord;
|
|
131
|
+
/**
|
|
132
|
+
* Render example object
|
|
133
|
+
*
|
|
134
|
+
* @param exampleName
|
|
135
|
+
* @param exampleProperties
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
138
|
+
const renderExampleObject = (exampleName, exampleProperties) => {
|
|
139
|
+
return (
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
react_1.default.createElement(
|
|
142
|
+
TabItem_1.default,
|
|
143
|
+
{ value: exampleName, label: exampleName },
|
|
144
|
+
exampleProperties.summary &&
|
|
145
|
+
react_1.default.createElement("p", null, exampleProperties.summary),
|
|
146
|
+
exampleProperties.description &&
|
|
147
|
+
react_1.default.createElement(
|
|
148
|
+
"p",
|
|
149
|
+
null,
|
|
150
|
+
react_1.default.createElement(
|
|
151
|
+
"strong",
|
|
152
|
+
null,
|
|
153
|
+
(0, Translate_1.translate)({
|
|
154
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DESCRIPTION,
|
|
155
|
+
message: "Description:",
|
|
156
|
+
}),
|
|
157
|
+
" "
|
|
158
|
+
),
|
|
159
|
+
react_1.default.createElement(
|
|
160
|
+
"span",
|
|
161
|
+
null,
|
|
162
|
+
exampleProperties.description
|
|
163
|
+
)
|
|
164
|
+
),
|
|
165
|
+
exampleProperties.value !== undefined
|
|
166
|
+
? renderExample(exampleProperties.value)
|
|
167
|
+
: undefined
|
|
168
|
+
)
|
|
169
|
+
);
|
|
170
|
+
};
|
|
@@ -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 BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
16
18
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
17
19
|
const ParamsItem_1 = __importDefault(require("@theme/ParamsItem"));
|
|
@@ -32,7 +34,13 @@ const ParamsDetailsComponent = ({ parameters }) => {
|
|
|
32
34
|
react_1.default.createElement(
|
|
33
35
|
"h3",
|
|
34
36
|
{ className: "openapi-markdown__details-summary-header-params" },
|
|
35
|
-
|
|
37
|
+
(0, Translate_1.translate)(
|
|
38
|
+
{
|
|
39
|
+
id: translationIds_1.OPENAPI_PARAMS_DETAILS.PARAMETERS_TITLE,
|
|
40
|
+
message: "{type} Parameters",
|
|
41
|
+
},
|
|
42
|
+
{ type: type.charAt(0).toUpperCase() + type.slice(1) }
|
|
43
|
+
)
|
|
36
44
|
)
|
|
37
45
|
);
|
|
38
46
|
return react_1.default.createElement(
|
|
@@ -12,16 +12,25 @@ 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 Example_1 = require("@theme/Example");
|
|
15
17
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
16
|
-
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
17
|
-
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
18
18
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
19
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
19
20
|
const clsx_1 = __importDefault(require("clsx"));
|
|
20
21
|
const schema_1 = require("../../markdown/schema");
|
|
21
22
|
const utils_1 = require("../../markdown/utils");
|
|
22
23
|
const getEnumDescriptionMarkdown = (enumDescriptions) => {
|
|
23
24
|
if (enumDescriptions?.length) {
|
|
24
|
-
|
|
25
|
+
const enumValue = (0, Translate_1.translate)({
|
|
26
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_VALUE,
|
|
27
|
+
message: "Enum Value",
|
|
28
|
+
});
|
|
29
|
+
const description = (0, Translate_1.translate)({
|
|
30
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_DESCRIPTION,
|
|
31
|
+
message: "Description",
|
|
32
|
+
});
|
|
33
|
+
return `| ${enumValue} | ${description} |
|
|
25
34
|
| ---- | ----- |
|
|
26
35
|
${enumDescriptions
|
|
27
36
|
.map((desc) => {
|
|
@@ -33,17 +42,11 @@ ${enumDescriptions
|
|
|
33
42
|
return "";
|
|
34
43
|
};
|
|
35
44
|
function ParamsItem({ param, ...rest }) {
|
|
36
|
-
const {
|
|
37
|
-
description,
|
|
38
|
-
example,
|
|
39
|
-
examples,
|
|
40
|
-
name,
|
|
41
|
-
required,
|
|
42
|
-
deprecated,
|
|
43
|
-
enumDescriptions,
|
|
44
|
-
} = param;
|
|
45
|
+
const { description, name, required, deprecated, enumDescriptions } = param;
|
|
45
46
|
let schema = param.schema;
|
|
46
47
|
let defaultValue;
|
|
48
|
+
let examples = param.examples ?? schema?.examples;
|
|
49
|
+
let example = param.example ?? schema?.example;
|
|
47
50
|
if (!schema) {
|
|
48
51
|
schema = { type: "any" };
|
|
49
52
|
}
|
|
@@ -69,14 +72,20 @@ function ParamsItem({ param, ...rest }) {
|
|
|
69
72
|
react_1.default.createElement(
|
|
70
73
|
"span",
|
|
71
74
|
{ className: "openapi-schema__required" },
|
|
72
|
-
|
|
75
|
+
(0, Translate_1.translate)({
|
|
76
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
77
|
+
message: "required",
|
|
78
|
+
})
|
|
73
79
|
)
|
|
74
80
|
);
|
|
75
81
|
const renderDeprecated = (0, utils_1.guard)(deprecated, () =>
|
|
76
82
|
react_1.default.createElement(
|
|
77
83
|
"span",
|
|
78
84
|
{ className: "openapi-schema__deprecated" },
|
|
79
|
-
|
|
85
|
+
(0, Translate_1.translate)({
|
|
86
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEPRECATED,
|
|
87
|
+
message: "deprecated",
|
|
88
|
+
})
|
|
80
89
|
)
|
|
81
90
|
);
|
|
82
91
|
const renderQualifier = (0, utils_1.guard)(
|
|
@@ -103,7 +112,15 @@ function ParamsItem({ param, ...rest }) {
|
|
|
103
112
|
return react_1.default.createElement(
|
|
104
113
|
"div",
|
|
105
114
|
null,
|
|
106
|
-
react_1.default.createElement(
|
|
115
|
+
react_1.default.createElement(
|
|
116
|
+
"strong",
|
|
117
|
+
null,
|
|
118
|
+
(0, Translate_1.translate)({
|
|
119
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
|
|
120
|
+
message: "Default value:",
|
|
121
|
+
}),
|
|
122
|
+
" "
|
|
123
|
+
),
|
|
107
124
|
react_1.default.createElement(
|
|
108
125
|
"span",
|
|
109
126
|
null,
|
|
@@ -114,7 +131,15 @@ function ParamsItem({ param, ...rest }) {
|
|
|
114
131
|
return react_1.default.createElement(
|
|
115
132
|
"div",
|
|
116
133
|
null,
|
|
117
|
-
react_1.default.createElement(
|
|
134
|
+
react_1.default.createElement(
|
|
135
|
+
"strong",
|
|
136
|
+
null,
|
|
137
|
+
(0, Translate_1.translate)({
|
|
138
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
|
|
139
|
+
message: "Default value:",
|
|
140
|
+
}),
|
|
141
|
+
" "
|
|
142
|
+
),
|
|
118
143
|
react_1.default.createElement(
|
|
119
144
|
"span",
|
|
120
145
|
null,
|
|
@@ -128,62 +153,6 @@ function ParamsItem({ param, ...rest }) {
|
|
|
128
153
|
}
|
|
129
154
|
return undefined;
|
|
130
155
|
}
|
|
131
|
-
const renderExample = (0, utils_1.guard)(
|
|
132
|
-
(0, utils_1.toString)(example),
|
|
133
|
-
(example) =>
|
|
134
|
-
react_1.default.createElement(
|
|
135
|
-
"div",
|
|
136
|
-
null,
|
|
137
|
-
react_1.default.createElement("strong", null, "Example: "),
|
|
138
|
-
example
|
|
139
|
-
)
|
|
140
|
-
);
|
|
141
|
-
const renderExamples = (0, utils_1.guard)(examples, (examples) => {
|
|
142
|
-
const exampleEntries = Object.entries(examples);
|
|
143
|
-
return react_1.default.createElement(
|
|
144
|
-
react_1.default.Fragment,
|
|
145
|
-
null,
|
|
146
|
-
react_1.default.createElement("strong", null, "Examples:"),
|
|
147
|
-
react_1.default.createElement(
|
|
148
|
-
SchemaTabs_1.default,
|
|
149
|
-
null,
|
|
150
|
-
exampleEntries.map(([exampleName, exampleProperties]) =>
|
|
151
|
-
// @ts-ignore
|
|
152
|
-
react_1.default.createElement(
|
|
153
|
-
TabItem_1.default,
|
|
154
|
-
{ value: exampleName, label: exampleName },
|
|
155
|
-
exampleProperties.summary &&
|
|
156
|
-
react_1.default.createElement(
|
|
157
|
-
"p",
|
|
158
|
-
null,
|
|
159
|
-
exampleProperties.summary
|
|
160
|
-
),
|
|
161
|
-
exampleProperties.description &&
|
|
162
|
-
react_1.default.createElement(
|
|
163
|
-
"p",
|
|
164
|
-
null,
|
|
165
|
-
react_1.default.createElement("strong", null, "Description: "),
|
|
166
|
-
react_1.default.createElement(
|
|
167
|
-
"span",
|
|
168
|
-
null,
|
|
169
|
-
exampleProperties.description
|
|
170
|
-
)
|
|
171
|
-
),
|
|
172
|
-
react_1.default.createElement(
|
|
173
|
-
"p",
|
|
174
|
-
null,
|
|
175
|
-
react_1.default.createElement("strong", null, "Example: "),
|
|
176
|
-
react_1.default.createElement(
|
|
177
|
-
"code",
|
|
178
|
-
null,
|
|
179
|
-
exampleProperties.value
|
|
180
|
-
)
|
|
181
|
-
)
|
|
182
|
-
)
|
|
183
|
-
)
|
|
184
|
-
)
|
|
185
|
-
);
|
|
186
|
-
});
|
|
187
156
|
return react_1.default.createElement(
|
|
188
157
|
"div",
|
|
189
158
|
{ className: "openapi-params__list-item" },
|
|
@@ -211,8 +180,8 @@ function ParamsItem({ param, ...rest }) {
|
|
|
211
180
|
renderDescription,
|
|
212
181
|
renderEnumDescriptions,
|
|
213
182
|
renderDefaultValue(),
|
|
214
|
-
|
|
215
|
-
|
|
183
|
+
react_1.default.createElement(Example_1.Example, { example: example }),
|
|
184
|
+
react_1.default.createElement(Example_1.Example, { examples: examples })
|
|
216
185
|
);
|
|
217
186
|
}
|
|
218
187
|
exports.default = ParamsItem;
|
|
@@ -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 BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
16
18
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
17
19
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
@@ -66,12 +68,18 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
66
68
|
className:
|
|
67
69
|
"openapi-markdown__details-summary-header-body",
|
|
68
70
|
},
|
|
69
|
-
|
|
71
|
+
(0, Translate_1.translate)({
|
|
72
|
+
id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
|
|
73
|
+
message: title,
|
|
74
|
+
}),
|
|
70
75
|
body.required === true &&
|
|
71
76
|
react_1.default.createElement(
|
|
72
77
|
"span",
|
|
73
78
|
{ className: "openapi-schema__required" },
|
|
74
|
-
|
|
79
|
+
(0, Translate_1.translate)({
|
|
80
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
81
|
+
message: "required",
|
|
82
|
+
})
|
|
75
83
|
)
|
|
76
84
|
)
|
|
77
85
|
)
|
|
@@ -133,7 +141,10 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
133
141
|
react_1.default.createElement(
|
|
134
142
|
"h3",
|
|
135
143
|
{ className: "openapi-markdown__details-summary-header-body" },
|
|
136
|
-
|
|
144
|
+
(0, Translate_1.translate)({
|
|
145
|
+
id: translationIds_1.OPENAPI_REQUEST.BODY_TITLE,
|
|
146
|
+
message: title,
|
|
147
|
+
}),
|
|
137
148
|
firstBody.type === "array" &&
|
|
138
149
|
react_1.default.createElement(
|
|
139
150
|
"span",
|
|
@@ -144,7 +155,10 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
144
155
|
react_1.default.createElement(
|
|
145
156
|
"strong",
|
|
146
157
|
{ className: "openapi-schema__required" },
|
|
147
|
-
|
|
158
|
+
(0, Translate_1.translate)({
|
|
159
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
160
|
+
message: "required",
|
|
161
|
+
})
|
|
148
162
|
)
|
|
149
163
|
)
|
|
150
164
|
)
|
|
@@ -17,9 +17,11 @@ exports.ExampleFromSchema =
|
|
|
17
17
|
void 0;
|
|
18
18
|
exports.json2xml = json2xml;
|
|
19
19
|
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
20
21
|
const CodeSamples_1 = __importDefault(require("@theme/CodeSamples"));
|
|
21
22
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
22
23
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
24
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
23
25
|
const createResponseExample_1 = require("docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample");
|
|
24
26
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
25
27
|
function json2xml(o, tab) {
|
|
@@ -107,7 +109,13 @@ const ResponseExample = ({ responseExample, mimeType }) => {
|
|
|
107
109
|
// @ts-ignore
|
|
108
110
|
react_1.default.createElement(
|
|
109
111
|
TabItem_1.default,
|
|
110
|
-
{
|
|
112
|
+
{
|
|
113
|
+
label: (0, Translate_1.translate)({
|
|
114
|
+
id: translationIds_1.OPENAPI_RESPONSE_EXAMPLES.EXAMPLE,
|
|
115
|
+
message: "Example",
|
|
116
|
+
}),
|
|
117
|
+
value: "Example",
|
|
118
|
+
},
|
|
111
119
|
responseExample.summary &&
|
|
112
120
|
react_1.default.createElement(
|
|
113
121
|
Markdown_1.default,
|
|
@@ -163,7 +171,13 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
163
171
|
// @ts-ignore
|
|
164
172
|
react_1.default.createElement(
|
|
165
173
|
TabItem_1.default,
|
|
166
|
-
{
|
|
174
|
+
{
|
|
175
|
+
label: (0, Translate_1.translate)({
|
|
176
|
+
id: translationIds_1.OPENAPI_RESPONSE_EXAMPLES.AUTO_EXAMPLE,
|
|
177
|
+
message: "Example (auto)",
|
|
178
|
+
}),
|
|
179
|
+
value: "Example (auto)",
|
|
180
|
+
},
|
|
167
181
|
react_1.default.createElement(CodeSamples_1.default, {
|
|
168
182
|
example: xmlExample,
|
|
169
183
|
language: "xml",
|
|
@@ -180,7 +194,13 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
180
194
|
// @ts-ignore
|
|
181
195
|
react_1.default.createElement(
|
|
182
196
|
TabItem_1.default,
|
|
183
|
-
{
|
|
197
|
+
{
|
|
198
|
+
label: (0, Translate_1.translate)({
|
|
199
|
+
id: translationIds_1.OPENAPI_RESPONSE_EXAMPLES.AUTO_EXAMPLE,
|
|
200
|
+
message: "Example (auto)",
|
|
201
|
+
}),
|
|
202
|
+
value: "Example (auto)",
|
|
203
|
+
},
|
|
184
204
|
react_1.default.createElement(CodeSamples_1.default, {
|
|
185
205
|
example: JSON.stringify(responseExample, null, 2),
|
|
186
206
|
language: "json",
|