docusaurus-plugin-openapi-docs 0.0.0-729 → 0.0.0-732

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/index.js CHANGED
@@ -372,6 +372,7 @@ custom_edit_url: null
372
372
  version: version,
373
373
  label: metadata.label,
374
374
  baseUrl: metadata.baseUrl,
375
+ downloadUrl: metadata.downloadUrl,
375
376
  });
376
377
  }
377
378
  const versionsJson = JSON.stringify(versionsArray, null, 2);
@@ -491,6 +492,7 @@ custom_edit_url: null
491
492
  delete parentConfig.version;
492
493
  delete parentConfig.label;
493
494
  delete parentConfig.baseUrl;
495
+ delete parentConfig.downloadUrl;
494
496
  // TODO: handle when no versions are defined by version command is passed
495
497
  if (versionId === "all") {
496
498
  if (versions[id]) {
package/lib/options.js CHANGED
@@ -54,6 +54,7 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
54
54
  outputDir: utils_validation_1.Joi.string().required(),
55
55
  label: utils_validation_1.Joi.string().required(),
56
56
  baseUrl: utils_validation_1.Joi.string().required(),
57
+ downloadUrl: utils_validation_1.Joi.string(),
57
58
  })),
58
59
  }))
59
60
  .required(),
@@ -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/lib/types.d.ts CHANGED
@@ -48,6 +48,7 @@ export interface APIVersionOptions {
48
48
  outputDir: string;
49
49
  label: string;
50
50
  baseUrl: string;
51
+ downloadUrl?: string;
51
52
  }
52
53
  export interface LoadedContent {
53
54
  loadedApi: ApiMetadata[];
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-729",
4
+ "version": "0.0.0-732",
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": "f90a3cfbe1426080ad61067d653ec30bb45d04a1"
63
+ "gitHead": "64996d73bd1090d1d28399f20e332cd7b236c4c6"
64
64
  }
package/src/index.ts CHANGED
@@ -532,6 +532,7 @@ custom_edit_url: null
532
532
  version: version,
533
533
  label: metadata.label,
534
534
  baseUrl: metadata.baseUrl,
535
+ downloadUrl: metadata.downloadUrl,
535
536
  });
536
537
  }
537
538
 
@@ -682,6 +683,7 @@ custom_edit_url: null
682
683
  delete parentConfig.version;
683
684
  delete parentConfig.label;
684
685
  delete parentConfig.baseUrl;
686
+ delete parentConfig.downloadUrl;
685
687
 
686
688
  // TODO: handle when no versions are defined by version command is passed
687
689
  if (versionId === "all") {
package/src/options.ts CHANGED
@@ -59,6 +59,7 @@ export const OptionsSchema = Joi.object({
59
59
  outputDir: Joi.string().required(),
60
60
  label: Joi.string().required(),
61
61
  baseUrl: Joi.string().required(),
62
+ downloadUrl: Joi.string(),
62
63
  })
63
64
  ),
64
65
  })
@@ -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
- } as ProcessedSidebarItem;
292
+ };
292
293
 
293
- sidebarSlice.push(groupCategory);
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
  }
package/src/types.ts CHANGED
@@ -70,6 +70,7 @@ export interface APIVersionOptions {
70
70
  outputDir: string;
71
71
  label: string;
72
72
  baseUrl: string;
73
+ downloadUrl?: string;
73
74
  }
74
75
 
75
76
  export interface LoadedContent {