docusaurus-plugin-openapi-docs 0.0.0-729 → 0.0.0-730
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/sidebars/index.js +12 -0
- package/package.json +2 -2
- package/src/sidebars/index.ts +17 -2
package/lib/sidebars/index.js
CHANGED
|
@@ -185,7 +185,9 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
|
|
|
185
185
|
function generateSidebarSlice(sidebarOptions, options, api, tags, docPath, tagGroups) {
|
|
186
186
|
let sidebarSlice = [];
|
|
187
187
|
if (sidebarOptions.groupPathsBy === "tagGroup") {
|
|
188
|
+
let schemasGroup = [];
|
|
188
189
|
tagGroups === null || tagGroups === void 0 ? void 0 : tagGroups.forEach((tagGroup) => {
|
|
190
|
+
var _a;
|
|
189
191
|
//filter tags only included in group
|
|
190
192
|
const filteredTags = [];
|
|
191
193
|
tags[0].forEach((tag) => {
|
|
@@ -200,8 +202,18 @@ function generateSidebarSlice(sidebarOptions, options, api, tags, docPath, tagGr
|
|
|
200
202
|
collapsed: true,
|
|
201
203
|
items: groupByTags(api, sidebarOptions, options, [filteredTags], docPath),
|
|
202
204
|
};
|
|
205
|
+
if (options.showSchemas) {
|
|
206
|
+
// For the first tagGroup, save the generated "Schemas" category for later.
|
|
207
|
+
if (schemasGroup.length === 0) {
|
|
208
|
+
schemasGroup = (_a = groupCategory.items) === null || _a === void 0 ? void 0 : _a.filter((item) => item.type === "category" && item.label === "Schemas");
|
|
209
|
+
}
|
|
210
|
+
// Remove the "Schemas" category from every `groupCategory`.
|
|
211
|
+
groupCategory.items = groupCategory.items.filter((item) => "label" in item ? item.label !== "Schemas" : true);
|
|
212
|
+
}
|
|
203
213
|
sidebarSlice.push(groupCategory);
|
|
204
214
|
});
|
|
215
|
+
// Add `schemasGroup` to the end of the sidebar.
|
|
216
|
+
sidebarSlice.push(...schemasGroup);
|
|
205
217
|
}
|
|
206
218
|
else if (sidebarOptions.groupPathsBy === "tag") {
|
|
207
219
|
sidebarSlice = groupByTags(api, sidebarOptions, options, tags, docPath);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-730",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "1d2eebcb4ad197684fb266157e22188b1b57c288"
|
|
64
64
|
}
|
package/src/sidebars/index.ts
CHANGED
|
@@ -267,6 +267,7 @@ export default function generateSidebarSlice(
|
|
|
267
267
|
let sidebarSlice: ProcessedSidebar = [];
|
|
268
268
|
|
|
269
269
|
if (sidebarOptions.groupPathsBy === "tagGroup") {
|
|
270
|
+
let schemasGroup: ProcessedSidebar = [];
|
|
270
271
|
tagGroups?.forEach((tagGroup) => {
|
|
271
272
|
//filter tags only included in group
|
|
272
273
|
const filteredTags: TagObject[] = [];
|
|
@@ -288,10 +289,24 @@ export default function generateSidebarSlice(
|
|
|
288
289
|
[filteredTags],
|
|
289
290
|
docPath
|
|
290
291
|
),
|
|
291
|
-
}
|
|
292
|
+
};
|
|
292
293
|
|
|
293
|
-
|
|
294
|
+
if (options.showSchemas) {
|
|
295
|
+
// For the first tagGroup, save the generated "Schemas" category for later.
|
|
296
|
+
if (schemasGroup.length === 0) {
|
|
297
|
+
schemasGroup = groupCategory.items?.filter(
|
|
298
|
+
(item) => item.type === "category" && item.label === "Schemas"
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
// Remove the "Schemas" category from every `groupCategory`.
|
|
302
|
+
groupCategory.items = groupCategory.items.filter((item) =>
|
|
303
|
+
"label" in item ? item.label !== "Schemas" : true
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
sidebarSlice.push(groupCategory as ProcessedSidebarItem);
|
|
294
307
|
});
|
|
308
|
+
// Add `schemasGroup` to the end of the sidebar.
|
|
309
|
+
sidebarSlice.push(...schemasGroup);
|
|
295
310
|
} else if (sidebarOptions.groupPathsBy === "tag") {
|
|
296
311
|
sidebarSlice = groupByTags(api, sidebarOptions, options, tags, docPath);
|
|
297
312
|
}
|