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,6 +13,7 @@ var __importDefault =
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
15
|
const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
16
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
16
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
17
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
18
19
|
const MimeTabs_1 = __importDefault(require("@theme/MimeTabs")); // Assume these components exist
|
|
@@ -21,6 +22,7 @@ const Schema_1 = __importDefault(require("@theme/Schema"));
|
|
|
21
22
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
22
23
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
23
24
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
25
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
24
26
|
const ResponseSchemaComponent = ({ title, body, style }) => {
|
|
25
27
|
if (
|
|
26
28
|
body === undefined ||
|
|
@@ -37,105 +39,118 @@ const ResponseSchemaComponent = ({ title, body, style }) => {
|
|
|
37
39
|
MimeTabs_1.default,
|
|
38
40
|
{ className: "openapi-tabs__mime", schemaType: "response" },
|
|
39
41
|
mimeTypes.map((mimeType) => {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const mediaTypeObject = body.content?.[mimeType];
|
|
43
|
+
const responseExamples = mediaTypeObject?.examples;
|
|
44
|
+
const responseExample = mediaTypeObject?.example;
|
|
45
|
+
const firstBody = mediaTypeObject?.schema;
|
|
44
46
|
if (
|
|
45
|
-
firstBody
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
!firstBody ||
|
|
48
|
+
(firstBody.properties &&
|
|
49
|
+
Object.keys(firstBody.properties).length === 0)
|
|
48
50
|
) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
if (firstBody) {
|
|
52
51
|
return (
|
|
53
52
|
// @ts-ignore
|
|
54
53
|
react_1.default.createElement(
|
|
55
54
|
TabItem_1.default,
|
|
56
55
|
{ key: mimeType, label: mimeType, value: mimeType },
|
|
57
56
|
react_1.default.createElement(
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
"div",
|
|
58
|
+
null,
|
|
59
|
+
(0, Translate_1.translate)({
|
|
60
|
+
id: translationIds_1.OPENAPI_SCHEMA.NO_SCHEMA,
|
|
61
|
+
message: "No schema",
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return (
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
react_1.default.createElement(
|
|
70
|
+
TabItem_1.default,
|
|
71
|
+
{ key: mimeType, label: mimeType, value: mimeType },
|
|
72
|
+
react_1.default.createElement(
|
|
73
|
+
SchemaTabs_1.default,
|
|
74
|
+
{ className: "openapi-tabs__schema" },
|
|
75
|
+
react_1.default.createElement(
|
|
76
|
+
TabItem_1.default,
|
|
77
|
+
{ key: title, label: title, value: title },
|
|
60
78
|
react_1.default.createElement(
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
Details_1.default,
|
|
80
|
+
{
|
|
81
|
+
className: "openapi-markdown__details response",
|
|
82
|
+
"data-collapsed": false,
|
|
83
|
+
open: true,
|
|
84
|
+
style: style,
|
|
85
|
+
summary: react_1.default.createElement(
|
|
86
|
+
react_1.default.Fragment,
|
|
87
|
+
null,
|
|
88
|
+
react_1.default.createElement(
|
|
89
|
+
"summary",
|
|
72
90
|
null,
|
|
73
91
|
react_1.default.createElement(
|
|
74
|
-
"
|
|
75
|
-
null,
|
|
76
|
-
react_1.default.createElement(
|
|
77
|
-
"strong",
|
|
78
|
-
{
|
|
79
|
-
className:
|
|
80
|
-
"openapi-markdown__details-summary-response",
|
|
81
|
-
},
|
|
82
|
-
title,
|
|
83
|
-
body.required === true &&
|
|
84
|
-
react_1.default.createElement(
|
|
85
|
-
"span",
|
|
86
|
-
{ className: "openapi-schema__required" },
|
|
87
|
-
"required"
|
|
88
|
-
)
|
|
89
|
-
)
|
|
90
|
-
)
|
|
91
|
-
),
|
|
92
|
-
},
|
|
93
|
-
react_1.default.createElement(
|
|
94
|
-
"div",
|
|
95
|
-
{ style: { textAlign: "left", marginLeft: "1rem" } },
|
|
96
|
-
body.description &&
|
|
97
|
-
react_1.default.createElement(
|
|
98
|
-
"div",
|
|
92
|
+
"strong",
|
|
99
93
|
{
|
|
100
|
-
|
|
94
|
+
className:
|
|
95
|
+
"openapi-markdown__details-summary-response",
|
|
101
96
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
title,
|
|
98
|
+
body.required === true &&
|
|
99
|
+
react_1.default.createElement(
|
|
100
|
+
"span",
|
|
101
|
+
{ className: "openapi-schema__required" },
|
|
102
|
+
(0, Translate_1.translate)({
|
|
103
|
+
id: translationIds_1.OPENAPI_SCHEMA_ITEM
|
|
104
|
+
.REQUIRED,
|
|
105
|
+
message: "required",
|
|
106
|
+
})
|
|
107
|
+
)
|
|
107
108
|
)
|
|
109
|
+
)
|
|
108
110
|
),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
},
|
|
112
|
+
react_1.default.createElement(
|
|
113
|
+
"div",
|
|
114
|
+
{ style: { textAlign: "left", marginLeft: "1rem" } },
|
|
115
|
+
body.description &&
|
|
116
|
+
react_1.default.createElement(
|
|
117
|
+
"div",
|
|
118
|
+
{ style: { marginTop: "1rem", marginBottom: "1rem" } },
|
|
119
|
+
react_1.default.createElement(
|
|
120
|
+
Markdown_1.default,
|
|
121
|
+
null,
|
|
122
|
+
body.description
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
),
|
|
126
|
+
react_1.default.createElement(
|
|
127
|
+
"ul",
|
|
128
|
+
{ style: { marginLeft: "1rem" } },
|
|
129
|
+
react_1.default.createElement(Schema_1.default, {
|
|
130
|
+
schema: firstBody,
|
|
131
|
+
schemaType: "response",
|
|
132
|
+
})
|
|
117
133
|
)
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
)
|
|
135
|
+
),
|
|
136
|
+
firstBody &&
|
|
137
|
+
(0, ResponseExamples_1.ExampleFromSchema)({
|
|
138
|
+
schema: firstBody,
|
|
139
|
+
mimeType: mimeType,
|
|
140
|
+
}),
|
|
141
|
+
responseExamples &&
|
|
142
|
+
(0, ResponseExamples_1.ResponseExamples)({
|
|
143
|
+
responseExamples,
|
|
144
|
+
mimeType,
|
|
145
|
+
}),
|
|
146
|
+
responseExample &&
|
|
147
|
+
(0, ResponseExamples_1.ResponseExample)({
|
|
148
|
+
responseExample,
|
|
149
|
+
mimeType,
|
|
150
|
+
})
|
|
135
151
|
)
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
return undefined;
|
|
152
|
+
)
|
|
153
|
+
);
|
|
139
154
|
})
|
|
140
155
|
);
|
|
141
156
|
}
|
|
@@ -3,6 +3,12 @@ import { SchemaObject } from "docusaurus-plugin-openapi-docs/lib/openapi/types";
|
|
|
3
3
|
interface SchemaProps {
|
|
4
4
|
schema: SchemaObject;
|
|
5
5
|
schemaType: "request" | "response";
|
|
6
|
+
/**
|
|
7
|
+
* Optional path identifier for tracking anyOf/oneOf selections.
|
|
8
|
+
* When provided, tab selections will be dispatched to Redux state
|
|
9
|
+
* to enable dynamic body example updates.
|
|
10
|
+
*/
|
|
11
|
+
schemaPath?: string;
|
|
6
12
|
}
|
|
7
13
|
declare const SchemaNode: React.FC<SchemaProps>;
|
|
8
14
|
export default SchemaNode;
|