docusaurus-theme-openapi-docs 4.5.1 → 4.7.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 +14 -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 +322 -193
- package/lib/theme/ApiExplorer/Body/resolveSchemaWithSelections.d.ts +13 -0
- package/lib/theme/ApiExplorer/Body/resolveSchemaWithSelections.js +133 -0
- 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/SchemaSelection/index.d.ts +2 -0
- package/lib/theme/ApiExplorer/SchemaSelection/index.js +36 -0
- package/lib/theme/ApiExplorer/SchemaSelection/slice.d.ts +37 -0
- package/lib/theme/ApiExplorer/SchemaSelection/slice.js +39 -0
- 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 +4 -0
- package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +21 -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 +10 -9
- package/lib/theme/ApiItem/index.js +13 -8
- package/lib/theme/ApiItem/store.d.ts +61 -43
- package/lib/theme/ApiItem/store.js +6 -2
- 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 +68 -48
- package/lib/theme/ResponseExamples/index.js +23 -3
- package/lib/theme/ResponseSchema/index.js +97 -82
- package/lib/theme/Schema/index.d.ts +6 -0
- package/lib/theme/Schema/index.js +240 -31
- package/lib/theme/SchemaItem/index.js +64 -36
- package/lib/theme/SchemaTabs/index.d.ts +8 -1
- package/lib/theme/SchemaTabs/index.js +14 -2
- package/lib/theme/StatusCodes/index.d.ts +1 -1
- package/lib/theme/StatusCodes/index.js +11 -2
- package/lib/theme/styles.scss +15 -0
- package/lib/theme/translationIds.d.ts +90 -0
- package/lib/theme/translationIds.js +114 -0
- package/package.json +28 -28
- package/src/markdown/schema.ts +17 -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 +262 -198
- package/{lib/types.js → src/theme/ApiExplorer/Body/json2xml.d.ts} +2 -2
- package/src/theme/ApiExplorer/Body/resolveSchemaWithSelections.ts +155 -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/SchemaSelection/index.ts +13 -0
- package/src/theme/ApiExplorer/SchemaSelection/slice.ts +46 -0
- 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 +5 -0
- 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 +13 -7
- package/src/theme/ApiItem/store.ts +2 -0
- 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 +60 -35
- package/src/theme/ResponseExamples/index.tsx +23 -3
- package/src/theme/ResponseSchema/index.tsx +73 -61
- package/src/theme/Schema/index.tsx +307 -55
- package/src/theme/SchemaItem/index.tsx +51 -33
- package/src/theme/SchemaTabs/index.tsx +19 -5
- package/src/theme/StatusCodes/index.tsx +13 -3
- package/src/theme/styles.scss +15 -0
- package/src/theme/translationIds.ts +111 -0
- package/src/theme-openapi.d.ts +7 -275
- package/src/{types.ts → types.d.ts} +9 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +0 -3
- package/lib/types.d.ts +0 -46
|
@@ -13,7 +13,10 @@ var __importDefault =
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.default = SchemaItem;
|
|
15
15
|
const react_1 = __importDefault(require("react"));
|
|
16
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
17
|
+
const Example_1 = require("@theme/Example");
|
|
16
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
19
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
17
20
|
const clsx_1 = __importDefault(require("clsx"));
|
|
18
21
|
const utils_1 = require("../../markdown/utils");
|
|
19
22
|
const transformEnumDescriptions = (enumDescriptions) => {
|
|
@@ -24,7 +27,15 @@ const transformEnumDescriptions = (enumDescriptions) => {
|
|
|
24
27
|
};
|
|
25
28
|
const getEnumDescriptionMarkdown = (enumDescriptions) => {
|
|
26
29
|
if (enumDescriptions?.length) {
|
|
27
|
-
|
|
30
|
+
const enumValue = (0, Translate_1.translate)({
|
|
31
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_VALUE,
|
|
32
|
+
message: "Enum Value",
|
|
33
|
+
});
|
|
34
|
+
const description = (0, Translate_1.translate)({
|
|
35
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.ENUM_DESCRIPTION,
|
|
36
|
+
message: "Description",
|
|
37
|
+
});
|
|
38
|
+
return `| ${enumValue} | ${description} |
|
|
28
39
|
| ---- | ----- |
|
|
29
40
|
${enumDescriptions
|
|
30
41
|
.map((desc) => {
|
|
@@ -49,6 +60,7 @@ function SchemaItem(props) {
|
|
|
49
60
|
let schemaDescription;
|
|
50
61
|
let defaultValue;
|
|
51
62
|
let example;
|
|
63
|
+
let examples;
|
|
52
64
|
let nullable;
|
|
53
65
|
let enumDescriptions = [];
|
|
54
66
|
let constValue;
|
|
@@ -58,6 +70,7 @@ function SchemaItem(props) {
|
|
|
58
70
|
enumDescriptions = transformEnumDescriptions(schema["x-enumDescriptions"]);
|
|
59
71
|
defaultValue = schema.default;
|
|
60
72
|
example = schema.example;
|
|
73
|
+
examples = schema.examples;
|
|
61
74
|
nullable =
|
|
62
75
|
schema.nullable ||
|
|
63
76
|
(Array.isArray(schema.type) && schema.type.includes("null")); // support JSON Schema nullable
|
|
@@ -69,21 +82,30 @@ function SchemaItem(props) {
|
|
|
69
82
|
react_1.default.createElement(
|
|
70
83
|
"span",
|
|
71
84
|
{ className: "openapi-schema__required" },
|
|
72
|
-
|
|
85
|
+
(0, Translate_1.translate)({
|
|
86
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.REQUIRED,
|
|
87
|
+
message: "required",
|
|
88
|
+
})
|
|
73
89
|
)
|
|
74
90
|
);
|
|
75
91
|
const renderDeprecated = (0, utils_1.guard)(deprecated, () =>
|
|
76
92
|
react_1.default.createElement(
|
|
77
93
|
"span",
|
|
78
94
|
{ className: "openapi-schema__deprecated" },
|
|
79
|
-
|
|
95
|
+
(0, Translate_1.translate)({
|
|
96
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEPRECATED,
|
|
97
|
+
message: "deprecated",
|
|
98
|
+
})
|
|
80
99
|
)
|
|
81
100
|
);
|
|
82
101
|
const renderNullable = (0, utils_1.guard)(nullable, () =>
|
|
83
102
|
react_1.default.createElement(
|
|
84
103
|
"span",
|
|
85
104
|
{ className: "openapi-schema__nullable" },
|
|
86
|
-
|
|
105
|
+
(0, Translate_1.translate)({
|
|
106
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.NULLABLE,
|
|
107
|
+
message: "nullable",
|
|
108
|
+
})
|
|
87
109
|
)
|
|
88
110
|
);
|
|
89
111
|
const renderEnumDescriptions = (0, utils_1.guard)(
|
|
@@ -120,7 +142,15 @@ function SchemaItem(props) {
|
|
|
120
142
|
return react_1.default.createElement(
|
|
121
143
|
"div",
|
|
122
144
|
null,
|
|
123
|
-
react_1.default.createElement(
|
|
145
|
+
react_1.default.createElement(
|
|
146
|
+
"strong",
|
|
147
|
+
null,
|
|
148
|
+
(0, Translate_1.translate)({
|
|
149
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
|
|
150
|
+
message: "Default value:",
|
|
151
|
+
}),
|
|
152
|
+
" "
|
|
153
|
+
),
|
|
124
154
|
react_1.default.createElement(
|
|
125
155
|
"span",
|
|
126
156
|
null,
|
|
@@ -131,7 +161,15 @@ function SchemaItem(props) {
|
|
|
131
161
|
return react_1.default.createElement(
|
|
132
162
|
"div",
|
|
133
163
|
null,
|
|
134
|
-
react_1.default.createElement(
|
|
164
|
+
react_1.default.createElement(
|
|
165
|
+
"strong",
|
|
166
|
+
null,
|
|
167
|
+
(0, Translate_1.translate)({
|
|
168
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.DEFAULT_VALUE,
|
|
169
|
+
message: "Default value:",
|
|
170
|
+
}),
|
|
171
|
+
" "
|
|
172
|
+
),
|
|
135
173
|
react_1.default.createElement(
|
|
136
174
|
"span",
|
|
137
175
|
null,
|
|
@@ -145,40 +183,21 @@ function SchemaItem(props) {
|
|
|
145
183
|
}
|
|
146
184
|
return undefined;
|
|
147
185
|
}
|
|
148
|
-
function renderExample() {
|
|
149
|
-
if (example !== undefined) {
|
|
150
|
-
if (typeof example === "string") {
|
|
151
|
-
return react_1.default.createElement(
|
|
152
|
-
"div",
|
|
153
|
-
null,
|
|
154
|
-
react_1.default.createElement("strong", null, "Example: "),
|
|
155
|
-
react_1.default.createElement(
|
|
156
|
-
"span",
|
|
157
|
-
null,
|
|
158
|
-
react_1.default.createElement("code", null, example)
|
|
159
|
-
)
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
return react_1.default.createElement(
|
|
163
|
-
"div",
|
|
164
|
-
null,
|
|
165
|
-
react_1.default.createElement("strong", null, "Example: "),
|
|
166
|
-
react_1.default.createElement(
|
|
167
|
-
"span",
|
|
168
|
-
null,
|
|
169
|
-
react_1.default.createElement("code", null, JSON.stringify(example))
|
|
170
|
-
)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
186
|
function renderConstValue() {
|
|
176
187
|
if (constValue !== undefined) {
|
|
177
188
|
if (typeof constValue === "string") {
|
|
178
189
|
return react_1.default.createElement(
|
|
179
190
|
"div",
|
|
180
191
|
null,
|
|
181
|
-
react_1.default.createElement(
|
|
192
|
+
react_1.default.createElement(
|
|
193
|
+
"strong",
|
|
194
|
+
null,
|
|
195
|
+
(0, Translate_1.translate)({
|
|
196
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.CONSTANT_VALUE,
|
|
197
|
+
message: "Constant value:",
|
|
198
|
+
}),
|
|
199
|
+
" "
|
|
200
|
+
),
|
|
182
201
|
react_1.default.createElement(
|
|
183
202
|
"span",
|
|
184
203
|
null,
|
|
@@ -189,7 +208,15 @@ function SchemaItem(props) {
|
|
|
189
208
|
return react_1.default.createElement(
|
|
190
209
|
"div",
|
|
191
210
|
null,
|
|
192
|
-
react_1.default.createElement(
|
|
211
|
+
react_1.default.createElement(
|
|
212
|
+
"strong",
|
|
213
|
+
null,
|
|
214
|
+
(0, Translate_1.translate)({
|
|
215
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM.CONSTANT_VALUE,
|
|
216
|
+
message: "Constant value:",
|
|
217
|
+
}),
|
|
218
|
+
" "
|
|
219
|
+
),
|
|
193
220
|
react_1.default.createElement(
|
|
194
221
|
"span",
|
|
195
222
|
null,
|
|
@@ -236,7 +263,8 @@ function SchemaItem(props) {
|
|
|
236
263
|
renderQualifierMessage,
|
|
237
264
|
renderConstValue(),
|
|
238
265
|
renderDefaultValue(),
|
|
239
|
-
|
|
266
|
+
react_1.default.createElement(Example_1.Example, { example: example }),
|
|
267
|
+
react_1.default.createElement(Example_1.Example, { examples: examples }),
|
|
240
268
|
collapsibleSchemaContent ?? collapsibleSchemaContent
|
|
241
269
|
);
|
|
242
270
|
return react_1.default.createElement(
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TabProps } from "@docusaurus/theme-common/internal";
|
|
3
|
-
export
|
|
3
|
+
export interface SchemaTabsProps extends TabProps {
|
|
4
|
+
/**
|
|
5
|
+
* Optional callback fired when the selected tab changes.
|
|
6
|
+
* Receives the index of the newly selected tab.
|
|
7
|
+
*/
|
|
8
|
+
onChange?: (index: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export default function SchemaTabs(props: SchemaTabsProps): React.JSX.Element;
|
|
@@ -73,7 +73,14 @@ const internal_1 = require("@docusaurus/theme-common/internal");
|
|
|
73
73
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
74
74
|
const clsx_1 = __importDefault(require("clsx"));
|
|
75
75
|
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
76
|
-
function TabList({
|
|
76
|
+
function TabList({
|
|
77
|
+
className,
|
|
78
|
+
block,
|
|
79
|
+
selectedValue,
|
|
80
|
+
selectValue,
|
|
81
|
+
tabValues,
|
|
82
|
+
onChange,
|
|
83
|
+
}) {
|
|
77
84
|
const tabRefs = [];
|
|
78
85
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
79
86
|
internal_1.useScrollPositionBlocker)();
|
|
@@ -84,6 +91,8 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) {
|
|
|
84
91
|
if (newTabValue !== selectedValue) {
|
|
85
92
|
blockElementScrollPositionUntilNextRender(newTab);
|
|
86
93
|
selectValue(newTabValue);
|
|
94
|
+
// Notify parent component of the tab change
|
|
95
|
+
onChange?.(newTabIndex);
|
|
87
96
|
}
|
|
88
97
|
};
|
|
89
98
|
const handleKeydown = (event) => {
|
|
@@ -141,7 +150,10 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) {
|
|
|
141
150
|
};
|
|
142
151
|
return react_1.default.createElement(
|
|
143
152
|
"div",
|
|
144
|
-
{
|
|
153
|
+
{
|
|
154
|
+
className: "openapi-tabs__schema-tabs-container",
|
|
155
|
+
style: { marginBottom: "1rem" },
|
|
156
|
+
},
|
|
145
157
|
showTabArrows &&
|
|
146
158
|
react_1.default.createElement("button", {
|
|
147
159
|
className: "openapi-tabs__arrow left",
|
|
@@ -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 ApiTabs_1 = __importDefault(require("@theme/ApiTabs"));
|
|
16
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
17
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
18
19
|
const ResponseHeaders_1 = __importDefault(require("@theme/ResponseHeaders"));
|
|
19
20
|
const ResponseSchema_1 = __importDefault(require("@theme/ResponseSchema"));
|
|
20
21
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
22
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
21
23
|
const StatusCodes = ({ label, id, responses }) => {
|
|
22
24
|
if (!responses) return null;
|
|
23
25
|
const codes = Object.keys(responses);
|
|
@@ -61,7 +63,11 @@ const StatusCodes = ({ label, id, responses }) => {
|
|
|
61
63
|
react_1.default.createElement(
|
|
62
64
|
"strong",
|
|
63
65
|
null,
|
|
64
|
-
|
|
66
|
+
(0, Translate_1.translate)({
|
|
67
|
+
id: translationIds_1.OPENAPI_STATUS_CODES
|
|
68
|
+
.RESPONSE_HEADERS,
|
|
69
|
+
message: "Response Headers",
|
|
70
|
+
})
|
|
65
71
|
)
|
|
66
72
|
),
|
|
67
73
|
},
|
|
@@ -70,7 +76,10 @@ const StatusCodes = ({ label, id, responses }) => {
|
|
|
70
76
|
})
|
|
71
77
|
),
|
|
72
78
|
react_1.default.createElement(ResponseSchema_1.default, {
|
|
73
|
-
title:
|
|
79
|
+
title: (0, Translate_1.translate)({
|
|
80
|
+
id: translationIds_1.OPENAPI_STATUS_CODES.SCHEMA_TITLE,
|
|
81
|
+
message: "Schema",
|
|
82
|
+
}),
|
|
74
83
|
body: { content: response.content },
|
|
75
84
|
})
|
|
76
85
|
)
|
package/lib/theme/styles.scss
CHANGED
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
@use "./CodeSamples/CodeSamples";
|
|
42
42
|
/* Markdown Styling */
|
|
43
43
|
@use "./Markdown/Details/Details";
|
|
44
|
+
/* Example Styling */
|
|
45
|
+
@use "./Example/Example";
|
|
44
46
|
|
|
45
47
|
:root {
|
|
46
48
|
--openapi-required: var(--ifm-color-danger);
|
|
@@ -67,6 +69,9 @@
|
|
|
67
69
|
--openapi-code-tab-border-color-java: #0374bd;
|
|
68
70
|
--openapi-code-tab-border-color-powershell: #00adef;
|
|
69
71
|
--openapi-code-tab-shadow-color-python: rgba(255, 219, 80, 0.25);
|
|
72
|
+
--openapi-code-tab-shadow-color-curl: var(
|
|
73
|
+
--openapi-code-tab-shadow-color-bash
|
|
74
|
+
);
|
|
70
75
|
--openapi-code-tab-shadow-color-bash: rgba(250, 56, 62, 0.25);
|
|
71
76
|
--openapi-code-tab-shadow-color-go: rgba(84, 199, 236, 0.25);
|
|
72
77
|
--openapi-code-tab-shadow-color-js: rgba(255, 186, 0, 0.25);
|
|
@@ -161,6 +166,16 @@
|
|
|
161
166
|
border-right: thin solid var(--ifm-toc-border-color);
|
|
162
167
|
}
|
|
163
168
|
|
|
169
|
+
@media (min-width: 997px) {
|
|
170
|
+
.openapi-right-panel__container {
|
|
171
|
+
position: sticky;
|
|
172
|
+
top: calc(var(--ifm-navbar-height) + 1rem);
|
|
173
|
+
max-height: calc(100vh - var(--ifm-navbar-height) - 2rem);
|
|
174
|
+
overflow-y: auto;
|
|
175
|
+
align-self: flex-start;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
164
179
|
@media (max-width: 997px) {
|
|
165
180
|
.schema {
|
|
166
181
|
margin-bottom: 1rem;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export declare const OPENAPI_RESPONSE: {
|
|
2
|
+
TITLE: string;
|
|
3
|
+
CLEAR: string;
|
|
4
|
+
PLACEHOLDER: string;
|
|
5
|
+
HEADERS_TAB: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const OPENAPI_TABS: {
|
|
8
|
+
RESPONSES_LABEL: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const OPENAPI_REQUEST: {
|
|
11
|
+
BODY_TITLE: string;
|
|
12
|
+
ACCEPT_TITLE: string;
|
|
13
|
+
SEND_BUTTON: string;
|
|
14
|
+
REQUIRED_LABEL: string;
|
|
15
|
+
REQUEST_TITLE: string;
|
|
16
|
+
COLLAPSE_ALL: string;
|
|
17
|
+
EXPAND_ALL: string;
|
|
18
|
+
BASE_URL_TITLE: string;
|
|
19
|
+
AUTH_TITLE: string;
|
|
20
|
+
PARAMETERS_TITLE: string;
|
|
21
|
+
FETCHING_MESSAGE: string;
|
|
22
|
+
CONNECTION_FAILED: string;
|
|
23
|
+
ERROR_TIMEOUT: string;
|
|
24
|
+
ERROR_NETWORK: string;
|
|
25
|
+
ERROR_CORS: string;
|
|
26
|
+
ERROR_UNKNOWN: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const OPENAPI_SERVER: {
|
|
29
|
+
EDIT_BUTTON: string;
|
|
30
|
+
HIDE_BUTTON: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const OPENAPI_PARAM_OPTIONS: {
|
|
33
|
+
SHOW_OPTIONAL: string;
|
|
34
|
+
HIDE_OPTIONAL: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const OPENAPI_FORM_FILE_UPLOAD: {
|
|
37
|
+
CLEAR_BUTTON: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const OPENAPI_FORM: {
|
|
40
|
+
FIELD_REQUIRED: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const OPENAPI_AUTH: {
|
|
43
|
+
BEARER_TOKEN: string;
|
|
44
|
+
USERNAME: string;
|
|
45
|
+
PASSWORD: string;
|
|
46
|
+
SECURITY_SCHEME: string;
|
|
47
|
+
};
|
|
48
|
+
export declare const OPENAPI_RESPONSE_EXAMPLES: {
|
|
49
|
+
EXAMPLE: string;
|
|
50
|
+
AUTO_EXAMPLE: string;
|
|
51
|
+
};
|
|
52
|
+
export declare const OPENAPI_BODY: {
|
|
53
|
+
EXAMPLE_FROM_SCHEMA: string;
|
|
54
|
+
};
|
|
55
|
+
export declare const OPENAPI_STATUS_CODES: {
|
|
56
|
+
RESPONSE_HEADERS: string;
|
|
57
|
+
SCHEMA_TITLE: string;
|
|
58
|
+
};
|
|
59
|
+
export declare const OPENAPI_SCHEMA: {
|
|
60
|
+
NO_SCHEMA: string;
|
|
61
|
+
};
|
|
62
|
+
export declare const OPENAPI_SCHEMA_ITEM: {
|
|
63
|
+
REQUIRED: string;
|
|
64
|
+
DEPRECATED: string;
|
|
65
|
+
NULLABLE: string;
|
|
66
|
+
DEFAULT_VALUE: string;
|
|
67
|
+
EXAMPLE: string;
|
|
68
|
+
EXAMPLES: string;
|
|
69
|
+
DESCRIPTION: string;
|
|
70
|
+
CONSTANT_VALUE: string;
|
|
71
|
+
ENUM_VALUE: string;
|
|
72
|
+
ENUM_DESCRIPTION: string;
|
|
73
|
+
POSSIBLE_VALUES: string;
|
|
74
|
+
ONE_OF: string;
|
|
75
|
+
ANY_OF: string;
|
|
76
|
+
};
|
|
77
|
+
export declare const OPENAPI_PARAMS_DETAILS: {
|
|
78
|
+
PARAMETERS_TITLE: string;
|
|
79
|
+
};
|
|
80
|
+
export declare const OPENAPI_SECURITY_SCHEMES: {
|
|
81
|
+
NAME: string;
|
|
82
|
+
TYPE: string;
|
|
83
|
+
SCOPES: string;
|
|
84
|
+
IN: string;
|
|
85
|
+
FLOWS: string;
|
|
86
|
+
DESCRIPTION: string;
|
|
87
|
+
SCHEME: string;
|
|
88
|
+
BEARER_FORMAT: string;
|
|
89
|
+
OPEN_ID_CONNECT_URL: string;
|
|
90
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OPENAPI_SECURITY_SCHEMES =
|
|
10
|
+
exports.OPENAPI_PARAMS_DETAILS =
|
|
11
|
+
exports.OPENAPI_SCHEMA_ITEM =
|
|
12
|
+
exports.OPENAPI_SCHEMA =
|
|
13
|
+
exports.OPENAPI_STATUS_CODES =
|
|
14
|
+
exports.OPENAPI_BODY =
|
|
15
|
+
exports.OPENAPI_RESPONSE_EXAMPLES =
|
|
16
|
+
exports.OPENAPI_AUTH =
|
|
17
|
+
exports.OPENAPI_FORM =
|
|
18
|
+
exports.OPENAPI_FORM_FILE_UPLOAD =
|
|
19
|
+
exports.OPENAPI_PARAM_OPTIONS =
|
|
20
|
+
exports.OPENAPI_SERVER =
|
|
21
|
+
exports.OPENAPI_REQUEST =
|
|
22
|
+
exports.OPENAPI_TABS =
|
|
23
|
+
exports.OPENAPI_RESPONSE =
|
|
24
|
+
void 0;
|
|
25
|
+
exports.OPENAPI_RESPONSE = {
|
|
26
|
+
TITLE: "theme.openapi.response.title",
|
|
27
|
+
CLEAR: "theme.openapi.response.clear",
|
|
28
|
+
PLACEHOLDER: "theme.openapi.response.placeholder",
|
|
29
|
+
HEADERS_TAB: "theme.openapi.response.headersTab",
|
|
30
|
+
};
|
|
31
|
+
exports.OPENAPI_TABS = {
|
|
32
|
+
RESPONSES_LABEL: "theme.openapi.tabs.responses.label",
|
|
33
|
+
};
|
|
34
|
+
exports.OPENAPI_REQUEST = {
|
|
35
|
+
BODY_TITLE: "theme.openapi.request.body.title",
|
|
36
|
+
ACCEPT_TITLE: "theme.openapi.request.accept.title",
|
|
37
|
+
SEND_BUTTON: "theme.openapi.request.sendButton",
|
|
38
|
+
REQUIRED_LABEL: "theme.openapi.request.requiredLabel",
|
|
39
|
+
REQUEST_TITLE: "theme.openapi.request.title",
|
|
40
|
+
COLLAPSE_ALL: "theme.openapi.request.collapseAll",
|
|
41
|
+
EXPAND_ALL: "theme.openapi.request.expandAll",
|
|
42
|
+
BASE_URL_TITLE: "theme.openapi.request.baseUrl.title",
|
|
43
|
+
AUTH_TITLE: "theme.openapi.request.auth.title",
|
|
44
|
+
PARAMETERS_TITLE: "theme.openapi.request.parameters.title",
|
|
45
|
+
FETCHING_MESSAGE: "theme.openapi.request.fetchingMessage",
|
|
46
|
+
CONNECTION_FAILED: "theme.openapi.request.connectionFailed",
|
|
47
|
+
ERROR_TIMEOUT: "theme.openapi.request.error.timeout",
|
|
48
|
+
ERROR_NETWORK: "theme.openapi.request.error.network",
|
|
49
|
+
ERROR_CORS: "theme.openapi.request.error.cors",
|
|
50
|
+
ERROR_UNKNOWN: "theme.openapi.request.error.unknown",
|
|
51
|
+
};
|
|
52
|
+
exports.OPENAPI_SERVER = {
|
|
53
|
+
EDIT_BUTTON: "theme.openapi.server.editButton",
|
|
54
|
+
HIDE_BUTTON: "theme.openapi.server.hideButton",
|
|
55
|
+
};
|
|
56
|
+
exports.OPENAPI_PARAM_OPTIONS = {
|
|
57
|
+
SHOW_OPTIONAL: "theme.openapi.paramOptions.showOptional",
|
|
58
|
+
HIDE_OPTIONAL: "theme.openapi.paramOptions.hideOptional",
|
|
59
|
+
};
|
|
60
|
+
exports.OPENAPI_FORM_FILE_UPLOAD = {
|
|
61
|
+
CLEAR_BUTTON: "theme.openapi.formFileUpload.clearButton",
|
|
62
|
+
};
|
|
63
|
+
exports.OPENAPI_FORM = {
|
|
64
|
+
FIELD_REQUIRED: "theme.openapi.form.fieldRequired",
|
|
65
|
+
};
|
|
66
|
+
exports.OPENAPI_AUTH = {
|
|
67
|
+
BEARER_TOKEN: "theme.openapi.auth.bearerToken",
|
|
68
|
+
USERNAME: "theme.openapi.auth.username",
|
|
69
|
+
PASSWORD: "theme.openapi.auth.password",
|
|
70
|
+
SECURITY_SCHEME: "theme.openapi.auth.securityScheme",
|
|
71
|
+
};
|
|
72
|
+
exports.OPENAPI_RESPONSE_EXAMPLES = {
|
|
73
|
+
EXAMPLE: "theme.openapi.responseExamples.example",
|
|
74
|
+
AUTO_EXAMPLE: "theme.openapi.responseExamples.autoExample",
|
|
75
|
+
};
|
|
76
|
+
exports.OPENAPI_BODY = {
|
|
77
|
+
EXAMPLE_FROM_SCHEMA: "theme.openapi.body.exampleFromSchema",
|
|
78
|
+
};
|
|
79
|
+
exports.OPENAPI_STATUS_CODES = {
|
|
80
|
+
RESPONSE_HEADERS: "theme.openapi.statusCodes.responseHeaders",
|
|
81
|
+
SCHEMA_TITLE: "theme.openapi.statusCodes.schemaTitle",
|
|
82
|
+
};
|
|
83
|
+
exports.OPENAPI_SCHEMA = {
|
|
84
|
+
NO_SCHEMA: "theme.openapi.schema.noSchema",
|
|
85
|
+
};
|
|
86
|
+
exports.OPENAPI_SCHEMA_ITEM = {
|
|
87
|
+
REQUIRED: "theme.openapi.schemaItem.required",
|
|
88
|
+
DEPRECATED: "theme.openapi.schemaItem.deprecated",
|
|
89
|
+
NULLABLE: "theme.openapi.schemaItem.nullable",
|
|
90
|
+
DEFAULT_VALUE: "theme.openapi.schemaItem.defaultValue",
|
|
91
|
+
EXAMPLE: "theme.openapi.schemaItem.example",
|
|
92
|
+
EXAMPLES: "theme.openapi.schemaItem.examples",
|
|
93
|
+
DESCRIPTION: "theme.openapi.schemaItem.description",
|
|
94
|
+
CONSTANT_VALUE: "theme.openapi.schemaItem.constantValue",
|
|
95
|
+
ENUM_VALUE: "theme.openapi.schemaItem.enumValue",
|
|
96
|
+
ENUM_DESCRIPTION: "theme.openapi.schemaItem.enumDescription",
|
|
97
|
+
POSSIBLE_VALUES: "theme.openapi.schemaItem.possibleValues",
|
|
98
|
+
ONE_OF: "theme.openapi.schemaItem.oneOf",
|
|
99
|
+
ANY_OF: "theme.openapi.schemaItem.anyOf",
|
|
100
|
+
};
|
|
101
|
+
exports.OPENAPI_PARAMS_DETAILS = {
|
|
102
|
+
PARAMETERS_TITLE: "theme.openapi.paramsDetails.parametersTitle",
|
|
103
|
+
};
|
|
104
|
+
exports.OPENAPI_SECURITY_SCHEMES = {
|
|
105
|
+
NAME: "theme.openapi.securitySchemes.name",
|
|
106
|
+
TYPE: "theme.openapi.securitySchemes.type",
|
|
107
|
+
SCOPES: "theme.openapi.securitySchemes.scopes",
|
|
108
|
+
IN: "theme.openapi.securitySchemes.in",
|
|
109
|
+
FLOWS: "theme.openapi.securitySchemes.flows",
|
|
110
|
+
DESCRIPTION: "theme.openapi.securitySchemes.description",
|
|
111
|
+
SCHEME: "theme.openapi.securitySchemes.scheme",
|
|
112
|
+
BEARER_FORMAT: "theme.openapi.securitySchemes.bearerFormat",
|
|
113
|
+
OPEN_ID_CONNECT_URL: "theme.openapi.securitySchemes.openIdConnectUrl",
|
|
114
|
+
};
|
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": "4.
|
|
4
|
+
"version": "4.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -31,45 +31,45 @@
|
|
|
31
31
|
"@docusaurus/theme-classic": "^3.5.0",
|
|
32
32
|
"@docusaurus/theme-common": "^3.5.0",
|
|
33
33
|
"@docusaurus/types": "^3.5.0",
|
|
34
|
-
"@types/crypto-js": "^4.
|
|
35
|
-
"@types/file-saver": "^2.0.
|
|
36
|
-
"@types/lodash": "^4.
|
|
34
|
+
"@types/crypto-js": "^4.2.2",
|
|
35
|
+
"@types/file-saver": "^2.0.7",
|
|
36
|
+
"@types/lodash": "^4.17.20",
|
|
37
37
|
"@types/pako": "^2.0.3",
|
|
38
38
|
"@types/postman-collection": "^3.5.11",
|
|
39
39
|
"@types/react-modal": "^3.16.3",
|
|
40
|
-
"concurrently": "^
|
|
41
|
-
"docusaurus-plugin-openapi-docs": "^4.
|
|
42
|
-
"docusaurus-plugin-sass": "^0.2.
|
|
43
|
-
"eslint-plugin-prettier": "^5.
|
|
40
|
+
"concurrently": "^9.2.0",
|
|
41
|
+
"docusaurus-plugin-openapi-docs": "^4.7.0",
|
|
42
|
+
"docusaurus-plugin-sass": "^0.2.6",
|
|
43
|
+
"eslint-plugin-prettier": "^5.5.1"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@hookform/error-message": "^2.0.1",
|
|
47
|
-
"@reduxjs/toolkit": "^
|
|
47
|
+
"@reduxjs/toolkit": "^2.8.2",
|
|
48
48
|
"allof-merge": "^0.6.6",
|
|
49
49
|
"buffer": "^6.0.3",
|
|
50
|
-
"clsx": "^
|
|
51
|
-
"copy-text-to-clipboard": "^3.
|
|
52
|
-
"crypto-js": "^4.
|
|
50
|
+
"clsx": "^2.1.1",
|
|
51
|
+
"copy-text-to-clipboard": "^3.2.0",
|
|
52
|
+
"crypto-js": "^4.2.0",
|
|
53
53
|
"file-saver": "^2.0.5",
|
|
54
|
-
"lodash": "^4.17.
|
|
54
|
+
"lodash": "^4.17.21",
|
|
55
55
|
"pako": "^2.1.0",
|
|
56
|
-
"postman-code-generators": "^
|
|
57
|
-
"postman-collection": "^
|
|
58
|
-
"prism-react-renderer": "^2.
|
|
56
|
+
"postman-code-generators": "^2.0.0",
|
|
57
|
+
"postman-collection": "^5.0.2",
|
|
58
|
+
"prism-react-renderer": "^2.4.1",
|
|
59
59
|
"process": "^0.11.10",
|
|
60
|
-
"react-hook-form": "^7.
|
|
61
|
-
"react-live": "^4.
|
|
60
|
+
"react-hook-form": "^7.59.0",
|
|
61
|
+
"react-live": "^4.1.8",
|
|
62
62
|
"react-magic-dropzone": "^1.0.1",
|
|
63
|
-
"react-markdown": "^
|
|
64
|
-
"react-modal": "^3.
|
|
65
|
-
"react-redux": "^
|
|
66
|
-
"rehype-raw": "^
|
|
67
|
-
"remark-gfm": "
|
|
68
|
-
"sass": "^1.
|
|
69
|
-
"sass-loader": "^16.0.
|
|
63
|
+
"react-markdown": "^10.1.0",
|
|
64
|
+
"react-modal": "^3.16.3",
|
|
65
|
+
"react-redux": "^9.2.0",
|
|
66
|
+
"rehype-raw": "^7.0.0",
|
|
67
|
+
"remark-gfm": "4.0.1",
|
|
68
|
+
"sass": "^1.89.2",
|
|
69
|
+
"sass-loader": "^16.0.5",
|
|
70
70
|
"unist-util-visit": "^5.0.0",
|
|
71
|
-
"url": "^0.11.
|
|
72
|
-
"xml-formatter": "^
|
|
71
|
+
"url": "^0.11.4",
|
|
72
|
+
"xml-formatter": "^3.6.6"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@docusaurus/theme-common": "^3.5.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=14"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f5829b8e478b0ee76344ba31edd67efdfea18990"
|
|
85
85
|
}
|
package/src/markdown/schema.ts
CHANGED
|
@@ -5,9 +5,18 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
+
import { translate } from "@docusaurus/Translate";
|
|
9
|
+
|
|
10
|
+
import { OPENAPI_SCHEMA_ITEM } from "../theme/translationIds";
|
|
8
11
|
import { SchemaObject } from "../types";
|
|
9
12
|
|
|
10
13
|
function prettyName(schema: SchemaObject, circular?: boolean) {
|
|
14
|
+
// Handle enum-only schemas (valid in JSON Schema)
|
|
15
|
+
// When enum is present without explicit type, treat as string
|
|
16
|
+
if (schema.enum && !schema.type) {
|
|
17
|
+
return "string";
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
if (schema.format) {
|
|
12
21
|
return schema.format;
|
|
13
22
|
}
|
|
@@ -40,6 +49,10 @@ function prettyName(schema: SchemaObject, circular?: boolean) {
|
|
|
40
49
|
// return schema.type;
|
|
41
50
|
}
|
|
42
51
|
|
|
52
|
+
if (Array.isArray(schema.type)) {
|
|
53
|
+
return schema.type.join(" | ");
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
return schema.title ?? schema.type;
|
|
44
57
|
}
|
|
45
58
|
|
|
@@ -72,7 +85,10 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
72
85
|
return getQualifierMessage(schema.items);
|
|
73
86
|
}
|
|
74
87
|
|
|
75
|
-
let message =
|
|
88
|
+
let message = `**${translate({
|
|
89
|
+
id: OPENAPI_SCHEMA_ITEM.POSSIBLE_VALUES,
|
|
90
|
+
message: "Possible values:",
|
|
91
|
+
})}** `;
|
|
76
92
|
|
|
77
93
|
let qualifierGroups = [];
|
|
78
94
|
|