docusaurus-plugin-openapi-docs 0.0.0-461 → 0.0.0-463

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
@@ -196,6 +196,10 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
196
196
  if (item.type === "api") {
197
197
  if (!fs_1.default.existsSync(`${outputDir}/${item.id}.api.mdx`)) {
198
198
  try {
199
+ // kebabCase(arg) returns 0-length string when arg is undefined
200
+ if (item.id.length === 0) {
201
+ throw Error("Operation must have summary or operationId defined");
202
+ }
199
203
  fs_1.default.writeFileSync(`${outputDir}/${item.id}.api.mdx`, view, "utf8");
200
204
  console.log(chalk_1.default.green(`Successfully created "${outputDir}/${item.id}.api.mdx"`));
201
205
  }
@@ -36,13 +36,12 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
36
36
  const operationTags = (0, uniq_1.default)(apiItems
37
37
  .flatMap((item) => item.api.tags)
38
38
  .filter((item) => !!item));
39
- // Only include operation tags that are globally defined
40
- const apiTags = [];
39
+ // Combine globally defined tags with operation tags
40
+ let apiTags = [];
41
41
  tags.flat().forEach((tag) => {
42
- if (operationTags.includes(tag.name)) {
43
- apiTags.push(tag.name);
44
- }
42
+ apiTags.push(tag.name);
45
43
  });
44
+ apiTags = (0, uniq_1.default)(apiTags.concat(operationTags));
46
45
  const basePath = docPath
47
46
  ? outputDir.split(docPath)[1].replace(/^\/+/g, "")
48
47
  : outputDir.slice(outputDir.indexOf("/", 1)).replace(/^\/+/g, "");
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-461",
4
+ "version": "0.0.0-463",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "8f104d54cad7b699a85a34d392f44da232e76c98"
71
+ "gitHead": "e3f53028e73dd772951d1a9ea168f93b37bb2308"
72
72
  }
package/src/index.ts CHANGED
@@ -235,6 +235,12 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
235
235
  if (item.type === "api") {
236
236
  if (!fs.existsSync(`${outputDir}/${item.id}.api.mdx`)) {
237
237
  try {
238
+ // kebabCase(arg) returns 0-length string when arg is undefined
239
+ if (item.id.length === 0) {
240
+ throw Error(
241
+ "Operation must have summary or operationId defined"
242
+ );
243
+ }
238
244
  fs.writeFileSync(`${outputDir}/${item.id}.api.mdx`, view, "utf8");
239
245
  console.log(
240
246
  chalk.green(
@@ -66,13 +66,12 @@ function groupByTags(
66
66
  .filter((item): item is string => !!item)
67
67
  );
68
68
 
69
- // Only include operation tags that are globally defined
70
- const apiTags: string[] = [];
69
+ // Combine globally defined tags with operation tags
70
+ let apiTags: string[] = [];
71
71
  tags.flat().forEach((tag) => {
72
- if (operationTags.includes(tag.name!)) {
73
- apiTags.push(tag.name!);
74
- }
72
+ apiTags.push(tag.name!);
75
73
  });
74
+ apiTags = uniq(apiTags.concat(operationTags));
76
75
 
77
76
  const basePath = docPath
78
77
  ? outputDir.split(docPath!)[1].replace(/^\/+/g, "")