docusaurus-theme-openapi-docs 5.0.2 → 5.1.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 +38 -15
- package/lib/markdown/schema.test.d.ts +1 -0
- package/lib/markdown/schema.test.js +86 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +4 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +9 -6
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Authorization/index.js +9 -10
- package/lib/theme/ApiExplorer/Body/index.js +4 -5
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +96 -61
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +12 -1
- package/lib/theme/ApiExplorer/CodeSnippets/languages.test.d.ts +1 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.test.js +102 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/CodeTabs/index.js +6 -5
- package/lib/theme/ApiExplorer/Export/index.js +9 -2
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +1 -2
- package/lib/theme/ApiExplorer/FormLabel/index.js +1 -2
- package/lib/theme/ApiExplorer/FormTextInput/index.js +1 -2
- package/lib/theme/ApiExplorer/LiveEditor/index.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +5 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +75 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +67 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +65 -1
- package/lib/theme/ApiExplorer/ParamOptions/index.js +2 -3
- package/lib/theme/ApiExplorer/Request/index.js +17 -18
- package/lib/theme/ApiExplorer/Response/index.js +54 -12
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +57 -50
- package/lib/theme/ApiExplorer/Server/index.js +2 -3
- package/lib/theme/ApiItem/index.js +59 -33
- package/lib/theme/ApiTabs/index.d.ts +1 -1
- package/lib/theme/ApiTabs/index.js +7 -7
- package/lib/theme/DiscriminatorTabs/index.d.ts +1 -1
- package/lib/theme/DiscriminatorTabs/index.js +6 -5
- package/lib/theme/Example/index.js +3 -4
- package/lib/theme/MimeTabs/index.d.ts +1 -1
- package/lib/theme/MimeTabs/index.js +6 -5
- package/lib/theme/OperationTabs/index.d.ts +1 -1
- package/lib/theme/OperationTabs/index.js +6 -5
- package/lib/theme/ParamsDetails/index.js +1 -2
- package/lib/theme/ParamsItem/index.js +7 -8
- package/lib/theme/RequestSchema/index.js +57 -57
- package/lib/theme/ResponseExamples/index.js +3 -4
- package/lib/theme/ResponseSchema/index.js +26 -24
- package/lib/theme/Schema/index.js +148 -27
- package/lib/theme/SchemaExpansion/_SchemaExpansion.scss +113 -0
- package/lib/theme/SchemaExpansion/context.d.ts +24 -0
- package/lib/theme/SchemaExpansion/context.js +187 -0
- package/lib/theme/SchemaExpansion/index.d.ts +4 -0
- package/lib/theme/SchemaExpansion/index.js +314 -0
- package/lib/theme/SchemaItem/index.js +9 -10
- package/lib/theme/SchemaTabs/index.d.ts +1 -1
- package/lib/theme/SchemaTabs/index.js +6 -5
- package/lib/theme/StatusCodes/index.js +2 -4
- package/lib/theme/TabItem/index.d.ts +5 -0
- package/lib/theme/TabItem/index.js +51 -0
- package/lib/theme/TabItem/styles.module.css +3 -0
- package/lib/theme/Tabs/index.d.ts +5 -0
- package/lib/theme/Tabs/index.js +148 -0
- package/lib/theme/Tabs/styles.module.css +7 -0
- package/lib/theme/styles.scss +1 -0
- package/lib/theme/translationIds.d.ts +1 -93
- package/lib/theme/translationIds.js +0 -109
- package/lib/theme/utils/codeBlockUtils.d.ts +28 -0
- package/lib/theme/utils/codeBlockUtils.js +223 -0
- package/lib/theme/utils/reactUtils.d.ts +1 -0
- package/lib/theme/utils/reactUtils.js +23 -0
- package/lib/theme/utils/scrollUtils.d.ts +7 -0
- package/lib/theme/utils/scrollUtils.js +175 -0
- package/lib/theme/utils/tabsUtils.d.ts +47 -0
- package/lib/theme/utils/tabsUtils.js +299 -0
- package/lib/theme/utils/useCodeWordWrap.d.ts +8 -0
- package/lib/theme/utils/useCodeWordWrap.js +84 -0
- package/lib/theme/utils/useMutationObserver.d.ts +3 -0
- package/lib/theme/utils/useMutationObserver.js +34 -0
- package/package.json +4 -4
- package/src/markdown/schema.test.ts +102 -0
- package/src/markdown/schema.ts +42 -15
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +8 -7
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +1 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +9 -10
- package/src/theme/ApiExplorer/Body/index.tsx +7 -5
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +103 -59
- package/src/theme/ApiExplorer/CodeSnippets/languages.test.ts +109 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +13 -1
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +5 -5
- package/src/theme/ApiExplorer/Export/index.tsx +6 -2
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +1 -2
- package/src/theme/ApiExplorer/FormLabel/index.tsx +1 -2
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +1 -2
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +5 -3
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +20 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +15 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +11 -1
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +2 -3
- package/src/theme/ApiExplorer/Request/index.tsx +23 -18
- package/src/theme/ApiExplorer/Response/index.tsx +63 -9
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +60 -52
- package/src/theme/ApiExplorer/Server/index.tsx +8 -3
- package/src/theme/ApiItem/index.tsx +43 -21
- package/src/theme/ApiTabs/index.tsx +8 -8
- package/src/theme/DiscriminatorTabs/index.tsx +6 -5
- package/src/theme/Example/index.tsx +3 -4
- package/src/theme/MimeTabs/index.tsx +9 -8
- package/src/theme/OperationTabs/index.tsx +5 -4
- package/src/theme/ParamsDetails/index.tsx +1 -2
- package/src/theme/ParamsItem/index.tsx +13 -8
- package/src/theme/RequestSchema/index.tsx +38 -40
- package/src/theme/ResponseExamples/index.tsx +3 -4
- package/src/theme/ResponseSchema/index.tsx +16 -17
- package/src/theme/Schema/index.tsx +156 -27
- package/src/theme/SchemaExpansion/_SchemaExpansion.scss +113 -0
- package/src/theme/SchemaExpansion/context.tsx +154 -0
- package/src/theme/SchemaExpansion/index.tsx +236 -0
- package/src/theme/SchemaItem/index.tsx +18 -10
- package/src/theme/SchemaTabs/index.tsx +6 -5
- package/src/theme/StatusCodes/index.tsx +2 -3
- package/src/theme/TabItem/index.tsx +61 -0
- package/src/theme/TabItem/styles.module.css +3 -0
- package/src/theme/Tabs/index.tsx +164 -0
- package/src/theme/Tabs/styles.module.css +7 -0
- package/src/theme/styles.scss +1 -0
- package/src/theme/translationIds.ts +37 -106
- package/src/theme/utils/codeBlockUtils.ts +296 -0
- package/src/theme/utils/reactUtils.ts +22 -0
- package/src/theme/utils/scrollUtils.tsx +153 -0
- package/src/theme/utils/tabsUtils.tsx +329 -0
- package/src/theme/utils/useCodeWordWrap.ts +110 -0
- package/src/theme/utils/useMutationObserver.ts +43 -0
- package/src/theme-classic.d.ts +0 -96
- package/src/types.d.ts +27 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -29,6 +29,7 @@ const storage_utils_1 = require("@theme/ApiExplorer/storage-utils");
|
|
|
29
29
|
const Layout_1 = __importDefault(require("@theme/ApiItem/Layout"));
|
|
30
30
|
const CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
|
|
31
31
|
const Metadata_1 = __importDefault(require("@theme/DocItem/Metadata"));
|
|
32
|
+
const SchemaExpansion_1 = require("@theme/SchemaExpansion");
|
|
32
33
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
33
34
|
const clsx_1 = __importDefault(require("clsx"));
|
|
34
35
|
const pako_1 = require("pako");
|
|
@@ -100,7 +101,22 @@ function ApiItem(props) {
|
|
|
100
101
|
api?.parameters?.forEach((param) => {
|
|
101
102
|
const paramType = param.in;
|
|
102
103
|
const paramsArray = params[paramType];
|
|
103
|
-
|
|
104
|
+
const p = param;
|
|
105
|
+
// Prefill order: schema.default, then example sources. `default` is
|
|
106
|
+
// semantically a server-side fallback, so for required params authors
|
|
107
|
+
// typically rely on `example` / `examples`. See #544 and #1079.
|
|
108
|
+
const firstNamedExample =
|
|
109
|
+
p.examples && typeof p.examples === "object"
|
|
110
|
+
? Object.values(p.examples)[0]?.value
|
|
111
|
+
: undefined;
|
|
112
|
+
const prefill =
|
|
113
|
+
p.schema?.default ??
|
|
114
|
+
p.example ??
|
|
115
|
+
p.schema?.example ??
|
|
116
|
+
firstNamedExample;
|
|
117
|
+
const initialized =
|
|
118
|
+
prefill !== undefined ? { ...param, value: prefill } : param;
|
|
119
|
+
paramsArray?.push(initialized);
|
|
104
120
|
});
|
|
105
121
|
const auth = (0, slice_1.createAuth)({
|
|
106
122
|
security: api?.security,
|
|
@@ -154,30 +170,34 @@ function ApiItem(props) {
|
|
|
154
170
|
react_redux_1.Provider,
|
|
155
171
|
{ store: store2 },
|
|
156
172
|
react_1.default.createElement(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
react_1.default.createElement(
|
|
160
|
-
"div",
|
|
161
|
-
{ className: "col col--7 openapi-left-panel__container" },
|
|
162
|
-
react_1.default.createElement(MDXComponent, null)
|
|
163
|
-
),
|
|
173
|
+
SchemaExpansion_1.SchemaExpansionProvider,
|
|
174
|
+
null,
|
|
164
175
|
react_1.default.createElement(
|
|
165
176
|
"div",
|
|
166
|
-
{ className: "
|
|
177
|
+
{ className: (0, clsx_1.default)("row", "theme-api-markdown") },
|
|
178
|
+
react_1.default.createElement(
|
|
179
|
+
"div",
|
|
180
|
+
{ className: "col col--7 openapi-left-panel__container" },
|
|
181
|
+
react_1.default.createElement(MDXComponent, null)
|
|
182
|
+
),
|
|
167
183
|
react_1.default.createElement(
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
"div",
|
|
185
|
+
{ className: "col col--5 openapi-right-panel__container" },
|
|
186
|
+
react_1.default.createElement(
|
|
187
|
+
BrowserOnly_1.default,
|
|
188
|
+
{
|
|
189
|
+
fallback: react_1.default.createElement(
|
|
190
|
+
SkeletonLoader_1.default,
|
|
191
|
+
{ size: "lg" }
|
|
192
|
+
),
|
|
193
|
+
},
|
|
194
|
+
() => {
|
|
195
|
+
return react_1.default.createElement(ApiExplorer, {
|
|
196
|
+
item: api,
|
|
197
|
+
infoPath: infoPath,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
)
|
|
181
201
|
)
|
|
182
202
|
)
|
|
183
203
|
)
|
|
@@ -197,20 +217,26 @@ function ApiItem(props) {
|
|
|
197
217
|
Layout_1.default,
|
|
198
218
|
null,
|
|
199
219
|
react_1.default.createElement(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
react_1.default.createElement(
|
|
203
|
-
"div",
|
|
204
|
-
{ className: "col col--7 openapi-left-panel__container schema" },
|
|
205
|
-
react_1.default.createElement(MDXComponent, null)
|
|
206
|
-
),
|
|
220
|
+
SchemaExpansion_1.SchemaExpansionProvider,
|
|
221
|
+
null,
|
|
207
222
|
react_1.default.createElement(
|
|
208
223
|
"div",
|
|
209
|
-
{ className: "
|
|
224
|
+
{ className: (0, clsx_1.default)("row", "theme-api-markdown") },
|
|
225
|
+
react_1.default.createElement(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: "col col--7 openapi-left-panel__container schema",
|
|
229
|
+
},
|
|
230
|
+
react_1.default.createElement(MDXComponent, null)
|
|
231
|
+
),
|
|
210
232
|
react_1.default.createElement(
|
|
211
|
-
|
|
212
|
-
{
|
|
213
|
-
|
|
233
|
+
"div",
|
|
234
|
+
{ className: "col col--5 openapi-right-panel__container" },
|
|
235
|
+
react_1.default.createElement(
|
|
236
|
+
CodeBlock_1.default,
|
|
237
|
+
{ language: "json", title: `${frontMatter.title}` },
|
|
238
|
+
JSON.stringify(sample, null, 2)
|
|
239
|
+
)
|
|
214
240
|
)
|
|
215
241
|
)
|
|
216
242
|
)
|
|
@@ -69,12 +69,12 @@ var __importDefault =
|
|
|
69
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
70
|
exports.default = ApiTabs;
|
|
71
71
|
const react_1 = __importStar(require("react"));
|
|
72
|
-
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
73
72
|
const Translate_1 = require("@docusaurus/Translate");
|
|
74
73
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
75
74
|
const Heading_1 = __importDefault(require("@theme/Heading"));
|
|
76
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
77
75
|
const clsx_1 = __importDefault(require("clsx"));
|
|
76
|
+
const scrollUtils_1 = require("@theme/utils/scrollUtils");
|
|
77
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
78
78
|
function TabList({
|
|
79
79
|
className,
|
|
80
80
|
block,
|
|
@@ -82,14 +82,14 @@ function TabList({
|
|
|
82
82
|
selectValue,
|
|
83
83
|
tabValues,
|
|
84
84
|
label = (0, Translate_1.translate)({
|
|
85
|
-
id:
|
|
85
|
+
id: "theme.openapi.tabs.responses.label",
|
|
86
86
|
message: "Responses",
|
|
87
87
|
}),
|
|
88
88
|
id = "responses",
|
|
89
89
|
}) {
|
|
90
90
|
const tabRefs = [];
|
|
91
91
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
92
|
-
|
|
92
|
+
scrollUtils_1.useScrollPositionBlocker)();
|
|
93
93
|
const handleTabChange = (event) => {
|
|
94
94
|
const newTab = event.currentTarget;
|
|
95
95
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
@@ -245,9 +245,9 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
function TabsComponent(props) {
|
|
248
|
-
const tabs = (0,
|
|
248
|
+
const tabs = (0, tabsUtils_1.useTabsContextValue)(props);
|
|
249
249
|
return react_1.default.createElement(
|
|
250
|
-
|
|
250
|
+
tabsUtils_1.TabsProvider,
|
|
251
251
|
{ value: tabs },
|
|
252
252
|
react_1.default.createElement(
|
|
253
253
|
"div",
|
|
@@ -269,6 +269,6 @@ function ApiTabs(props) {
|
|
|
269
269
|
key: String(isBrowser),
|
|
270
270
|
...props,
|
|
271
271
|
},
|
|
272
|
-
(0,
|
|
272
|
+
(0, tabsUtils_1.sanitizeTabsChildren)(props.children)
|
|
273
273
|
);
|
|
274
274
|
}
|
|
@@ -69,14 +69,15 @@ var __importDefault =
|
|
|
69
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
70
|
exports.default = DiscriminatorTabs;
|
|
71
71
|
const react_1 = __importStar(require("react"));
|
|
72
|
-
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
73
72
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
74
73
|
const clsx_1 = __importDefault(require("clsx"));
|
|
75
74
|
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
75
|
+
const scrollUtils_1 = require("@theme/utils/scrollUtils");
|
|
76
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
76
77
|
function TabList({ className, block, selectedValue, selectValue, tabValues }) {
|
|
77
78
|
const tabRefs = [];
|
|
78
79
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
79
|
-
|
|
80
|
+
scrollUtils_1.useScrollPositionBlocker)();
|
|
80
81
|
const handleTabChange = (event) => {
|
|
81
82
|
const newTab = event.currentTarget;
|
|
82
83
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
@@ -223,9 +224,9 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
223
224
|
);
|
|
224
225
|
}
|
|
225
226
|
function TabsComponent(props) {
|
|
226
|
-
const tabs = (0,
|
|
227
|
+
const tabs = (0, tabsUtils_1.useTabsContextValue)(props);
|
|
227
228
|
return react_1.default.createElement(
|
|
228
|
-
|
|
229
|
+
tabsUtils_1.TabsProvider,
|
|
229
230
|
{ value: tabs },
|
|
230
231
|
react_1.default.createElement(
|
|
231
232
|
"div",
|
|
@@ -252,6 +253,6 @@ function DiscriminatorTabs(props) {
|
|
|
252
253
|
key: String(isBrowser),
|
|
253
254
|
...props,
|
|
254
255
|
},
|
|
255
|
-
(0,
|
|
256
|
+
(0, tabsUtils_1.sanitizeTabsChildren)(props.children)
|
|
256
257
|
);
|
|
257
258
|
}
|
|
@@ -17,7 +17,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
17
17
|
const Translate_1 = require("@docusaurus/Translate");
|
|
18
18
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
19
19
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
20
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
21
20
|
const EXAMPLE_CLASS_NAME = "openapi-example";
|
|
22
21
|
const EXAMPLES_CLASS_NAME = "openapi-examples";
|
|
23
22
|
/**
|
|
@@ -53,7 +52,7 @@ const renderExample = (example) => {
|
|
|
53
52
|
"strong",
|
|
54
53
|
null,
|
|
55
54
|
(0, Translate_1.translate)({
|
|
56
|
-
id:
|
|
55
|
+
id: "theme.openapi.schemaItem.example",
|
|
57
56
|
message: "Example:",
|
|
58
57
|
}),
|
|
59
58
|
" "
|
|
@@ -114,7 +113,7 @@ const renderExamplesRecord = (examples) => {
|
|
|
114
113
|
"strong",
|
|
115
114
|
null,
|
|
116
115
|
(0, Translate_1.translate)({
|
|
117
|
-
id:
|
|
116
|
+
id: "theme.openapi.schemaItem.examples",
|
|
118
117
|
message: "Examples:",
|
|
119
118
|
})
|
|
120
119
|
),
|
|
@@ -151,7 +150,7 @@ const renderExampleObject = (exampleName, exampleProperties) => {
|
|
|
151
150
|
"strong",
|
|
152
151
|
null,
|
|
153
152
|
(0, Translate_1.translate)({
|
|
154
|
-
id:
|
|
153
|
+
id: "theme.openapi.schemaItem.description",
|
|
155
154
|
message: "Description:",
|
|
156
155
|
}),
|
|
157
156
|
" "
|
|
@@ -69,12 +69,13 @@ var __importDefault =
|
|
|
69
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
70
|
exports.default = MimeTabs;
|
|
71
71
|
const react_1 = __importStar(require("react"));
|
|
72
|
-
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
73
72
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
74
73
|
const slice_1 = require("@theme/ApiExplorer/Accept/slice");
|
|
75
74
|
const slice_2 = require("@theme/ApiExplorer/ContentType/slice");
|
|
76
75
|
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
77
76
|
const clsx_1 = __importDefault(require("clsx"));
|
|
77
|
+
const scrollUtils_1 = require("@theme/utils/scrollUtils");
|
|
78
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
78
79
|
function TabList({
|
|
79
80
|
className,
|
|
80
81
|
block,
|
|
@@ -85,7 +86,7 @@ function TabList({
|
|
|
85
86
|
}) {
|
|
86
87
|
const tabRefs = [];
|
|
87
88
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
88
|
-
|
|
89
|
+
scrollUtils_1.useScrollPositionBlocker)();
|
|
89
90
|
// custom
|
|
90
91
|
const dispatch = (0, hooks_1.useTypedDispatch)();
|
|
91
92
|
const isRequestSchema = schemaType?.toLowerCase() === "request";
|
|
@@ -256,9 +257,9 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
256
257
|
);
|
|
257
258
|
}
|
|
258
259
|
function TabsComponent(props) {
|
|
259
|
-
const tabs = (0,
|
|
260
|
+
const tabs = (0, tabsUtils_1.useTabsContextValue)(props);
|
|
260
261
|
return react_1.default.createElement(
|
|
261
|
-
|
|
262
|
+
tabsUtils_1.TabsProvider,
|
|
262
263
|
{ value: tabs },
|
|
263
264
|
react_1.default.createElement(
|
|
264
265
|
"div",
|
|
@@ -280,6 +281,6 @@ function MimeTabs(props) {
|
|
|
280
281
|
key: String(isBrowser),
|
|
281
282
|
...props,
|
|
282
283
|
},
|
|
283
|
-
(0,
|
|
284
|
+
(0, tabsUtils_1.sanitizeTabsChildren)(props.children)
|
|
284
285
|
);
|
|
285
286
|
}
|
|
@@ -69,13 +69,14 @@ var __importDefault =
|
|
|
69
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
70
|
exports.default = OperationTabs;
|
|
71
71
|
const react_1 = __importStar(require("react"));
|
|
72
|
-
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
73
72
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
74
73
|
const clsx_1 = __importDefault(require("clsx"));
|
|
74
|
+
const scrollUtils_1 = require("@theme/utils/scrollUtils");
|
|
75
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
75
76
|
function TabList({ className, block, selectedValue, selectValue, tabValues }) {
|
|
76
77
|
const tabRefs = [];
|
|
77
78
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
78
|
-
|
|
79
|
+
scrollUtils_1.useScrollPositionBlocker)();
|
|
79
80
|
const handleTabChange = (event) => {
|
|
80
81
|
const newTab = event.currentTarget;
|
|
81
82
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
@@ -218,9 +219,9 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
218
219
|
);
|
|
219
220
|
}
|
|
220
221
|
function TabsComponent(props) {
|
|
221
|
-
const tabs = (0,
|
|
222
|
+
const tabs = (0, tabsUtils_1.useTabsContextValue)(props);
|
|
222
223
|
return react_1.default.createElement(
|
|
223
|
-
|
|
224
|
+
tabsUtils_1.TabsProvider,
|
|
224
225
|
{ value: tabs },
|
|
225
226
|
react_1.default.createElement(
|
|
226
227
|
"div",
|
|
@@ -242,6 +243,6 @@ function OperationTabs(props) {
|
|
|
242
243
|
key: String(isBrowser),
|
|
243
244
|
...props,
|
|
244
245
|
},
|
|
245
|
-
(0,
|
|
246
|
+
(0, tabsUtils_1.sanitizeTabsChildren)(props.children)
|
|
246
247
|
);
|
|
247
248
|
}
|
|
@@ -17,7 +17,6 @@ const Translate_1 = require("@docusaurus/Translate");
|
|
|
17
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
18
18
|
const ParamsItem_1 = __importDefault(require("@theme/ParamsItem"));
|
|
19
19
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
20
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
21
20
|
const ParamsDetailsComponent = ({ parameters }) => {
|
|
22
21
|
const types = ["path", "query", "header", "cookie"];
|
|
23
22
|
return react_1.default.createElement(
|
|
@@ -36,7 +35,7 @@ const ParamsDetailsComponent = ({ parameters }) => {
|
|
|
36
35
|
{ className: "openapi-markdown__details-summary-header-params" },
|
|
37
36
|
(0, Translate_1.translate)(
|
|
38
37
|
{
|
|
39
|
-
id:
|
|
38
|
+
id: "theme.openapi.paramsDetails.parametersTitle",
|
|
40
39
|
message: "{type} Parameters",
|
|
41
40
|
},
|
|
42
41
|
{ type: type.charAt(0).toUpperCase() + type.slice(1) }
|
|
@@ -16,18 +16,17 @@ const Translate_1 = require("@docusaurus/Translate");
|
|
|
16
16
|
const Example_1 = require("@theme/Example");
|
|
17
17
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
18
18
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
19
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
20
19
|
const clsx_1 = __importDefault(require("clsx"));
|
|
21
20
|
const schema_1 = require("../../markdown/schema");
|
|
22
21
|
const utils_1 = require("../../markdown/utils");
|
|
23
22
|
const getEnumDescriptionMarkdown = (enumDescriptions) => {
|
|
24
23
|
if (enumDescriptions?.length) {
|
|
25
24
|
const enumValue = (0, Translate_1.translate)({
|
|
26
|
-
id:
|
|
25
|
+
id: "theme.openapi.schemaItem.enumValue",
|
|
27
26
|
message: "Enum Value",
|
|
28
27
|
});
|
|
29
28
|
const description = (0, Translate_1.translate)({
|
|
30
|
-
id:
|
|
29
|
+
id: "theme.openapi.schemaItem.enumDescription",
|
|
31
30
|
message: "Description",
|
|
32
31
|
});
|
|
33
32
|
return `| ${enumValue} | ${description} |
|
|
@@ -73,7 +72,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
73
72
|
"span",
|
|
74
73
|
{ className: "openapi-schema__required" },
|
|
75
74
|
(0, Translate_1.translate)({
|
|
76
|
-
id:
|
|
75
|
+
id: "theme.openapi.schemaItem.required",
|
|
77
76
|
message: "required",
|
|
78
77
|
})
|
|
79
78
|
)
|
|
@@ -83,7 +82,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
83
82
|
"span",
|
|
84
83
|
{ className: "openapi-schema__deprecated" },
|
|
85
84
|
(0, Translate_1.translate)({
|
|
86
|
-
id:
|
|
85
|
+
id: "theme.openapi.schemaItem.deprecated",
|
|
87
86
|
message: "deprecated",
|
|
88
87
|
})
|
|
89
88
|
)
|
|
@@ -99,7 +98,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
99
98
|
return undefined;
|
|
100
99
|
}
|
|
101
100
|
const label = (0, Translate_1.translate)({
|
|
102
|
-
id:
|
|
101
|
+
id: "theme.openapi.schemaItem.constantValue",
|
|
103
102
|
message: "Constant value:",
|
|
104
103
|
});
|
|
105
104
|
return react_1.default.createElement(
|
|
@@ -142,7 +141,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
142
141
|
"strong",
|
|
143
142
|
null,
|
|
144
143
|
(0, Translate_1.translate)({
|
|
145
|
-
id:
|
|
144
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
146
145
|
message: "Default value:",
|
|
147
146
|
}),
|
|
148
147
|
" "
|
|
@@ -161,7 +160,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
161
160
|
"strong",
|
|
162
161
|
null,
|
|
163
162
|
(0, Translate_1.translate)({
|
|
164
|
-
id:
|
|
163
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
165
164
|
message: "Default value:",
|
|
166
165
|
}),
|
|
167
166
|
" "
|
|
@@ -19,10 +19,10 @@ const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
|
19
19
|
const MimeTabs_1 = __importDefault(require("@theme/MimeTabs")); // Assume these components exist
|
|
20
20
|
const ResponseExamples_1 = require("@theme/ResponseExamples");
|
|
21
21
|
const Schema_1 = __importDefault(require("@theme/Schema"));
|
|
22
|
+
const SchemaExpansion_1 = __importDefault(require("@theme/SchemaExpansion"));
|
|
22
23
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
23
24
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
24
25
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
25
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
26
26
|
const RequestSchemaComponent = ({ title, body, style }) => {
|
|
27
27
|
if (
|
|
28
28
|
body === undefined ||
|
|
@@ -71,32 +71,34 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
71
71
|
open: true,
|
|
72
72
|
style: style,
|
|
73
73
|
summary: react_1.default.createElement(
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
"summary",
|
|
75
|
+
{
|
|
76
|
+
className:
|
|
77
|
+
"openapi-markdown__details-summary--with-control",
|
|
78
|
+
},
|
|
76
79
|
react_1.default.createElement(
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
80
|
+
"h3",
|
|
81
|
+
{
|
|
82
|
+
className:
|
|
83
|
+
"openapi-markdown__details-summary-header-body",
|
|
84
|
+
},
|
|
85
|
+
(0, Translate_1.translate)({
|
|
86
|
+
id: "theme.openapi.request.body.title",
|
|
87
|
+
message: title,
|
|
88
|
+
}),
|
|
89
|
+
body.required === true &&
|
|
90
|
+
react_1.default.createElement(
|
|
91
|
+
"span",
|
|
92
|
+
{ className: "openapi-schema__required" },
|
|
93
|
+
(0, Translate_1.translate)({
|
|
94
|
+
id: "theme.openapi.schemaItem.required",
|
|
95
|
+
message: "required",
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
),
|
|
99
|
+
react_1.default.createElement(
|
|
100
|
+
SchemaExpansion_1.default,
|
|
101
|
+
null
|
|
100
102
|
)
|
|
101
103
|
),
|
|
102
104
|
},
|
|
@@ -179,38 +181,36 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
179
181
|
open: true,
|
|
180
182
|
style: style,
|
|
181
183
|
summary: react_1.default.createElement(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
"summary",
|
|
185
|
+
{
|
|
186
|
+
className: "openapi-markdown__details-summary--with-control",
|
|
187
|
+
},
|
|
184
188
|
react_1.default.createElement(
|
|
185
|
-
"
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
"
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
})
|
|
211
|
-
)
|
|
212
|
-
)
|
|
213
|
-
)
|
|
189
|
+
"h3",
|
|
190
|
+
{
|
|
191
|
+
className: "openapi-markdown__details-summary-header-body",
|
|
192
|
+
},
|
|
193
|
+
(0, Translate_1.translate)({
|
|
194
|
+
id: "theme.openapi.request.body.title",
|
|
195
|
+
message: title,
|
|
196
|
+
}),
|
|
197
|
+
firstBody.type === "array" &&
|
|
198
|
+
react_1.default.createElement(
|
|
199
|
+
"span",
|
|
200
|
+
{ style: { opacity: "0.6" } },
|
|
201
|
+
" array"
|
|
202
|
+
),
|
|
203
|
+
body.required &&
|
|
204
|
+
react_1.default.createElement(
|
|
205
|
+
"strong",
|
|
206
|
+
{ className: "openapi-schema__required" },
|
|
207
|
+
(0, Translate_1.translate)({
|
|
208
|
+
id: "theme.openapi.schemaItem.required",
|
|
209
|
+
message: "required",
|
|
210
|
+
})
|
|
211
|
+
)
|
|
212
|
+
),
|
|
213
|
+
react_1.default.createElement(SchemaExpansion_1.default, null)
|
|
214
214
|
),
|
|
215
215
|
},
|
|
216
216
|
react_1.default.createElement(
|
|
@@ -21,7 +21,6 @@ const Translate_1 = require("@docusaurus/Translate");
|
|
|
21
21
|
const CodeSamples_1 = __importDefault(require("@theme/CodeSamples"));
|
|
22
22
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
23
23
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
24
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
25
24
|
const createResponseExample_1 = require("docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample");
|
|
26
25
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
27
26
|
function json2xml(o, tab) {
|
|
@@ -111,7 +110,7 @@ const ResponseExample = ({ responseExample, mimeType }) => {
|
|
|
111
110
|
TabItem_1.default,
|
|
112
111
|
{
|
|
113
112
|
label: (0, Translate_1.translate)({
|
|
114
|
-
id:
|
|
113
|
+
id: "theme.openapi.responseExamples.example",
|
|
115
114
|
message: "Example",
|
|
116
115
|
}),
|
|
117
116
|
value: "Example",
|
|
@@ -173,7 +172,7 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
173
172
|
TabItem_1.default,
|
|
174
173
|
{
|
|
175
174
|
label: (0, Translate_1.translate)({
|
|
176
|
-
id:
|
|
175
|
+
id: "theme.openapi.responseExamples.autoExample",
|
|
177
176
|
message: "Example (auto)",
|
|
178
177
|
}),
|
|
179
178
|
value: "Example (auto)",
|
|
@@ -196,7 +195,7 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
196
195
|
TabItem_1.default,
|
|
197
196
|
{
|
|
198
197
|
label: (0, Translate_1.translate)({
|
|
199
|
-
id:
|
|
198
|
+
id: "theme.openapi.responseExamples.autoExample",
|
|
200
199
|
message: "Example (auto)",
|
|
201
200
|
}),
|
|
202
201
|
value: "Example (auto)",
|