docusaurus-plugin-openapi-docs 1.1.3 → 1.1.6

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.
@@ -1,4 +1,4 @@
1
1
  import { ProcessedSidebar } from "@docusaurus/plugin-content-docs/src/sidebars/types";
2
2
  import { TagObject } from "../openapi/types";
3
3
  import type { SidebarOptions, APIOptions, ApiMetadata } from "../types";
4
- export default function generateSidebarSlice(sidebarOptions: SidebarOptions, options: APIOptions, api: ApiMetadata[], tags: TagObject[], docPath: string): ProcessedSidebar;
4
+ export default function generateSidebarSlice(sidebarOptions: SidebarOptions, options: APIOptions, api: ApiMetadata[], tags: TagObject[][], docPath: string): ProcessedSidebar;
@@ -33,9 +33,16 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
33
33
  };
34
34
  });
35
35
  // TODO: make sure we only take the first tag
36
- const apiTags = (0, uniq_1.default)(apiItems
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 = [];
41
+ tags.flat().forEach((tag) => {
42
+ if (operationTags.includes(tag.name)) {
43
+ apiTags.push(tag.name);
44
+ }
45
+ });
39
46
  const basePath = docPath
40
47
  ? outputDir.split(docPath)[1].replace(/^\/+/g, "")
41
48
  : outputDir.slice(outputDir.indexOf("/", 1)).replace(/^\/+/g, "");
@@ -66,11 +73,12 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
66
73
  }
67
74
  const tagged = apiTags
68
75
  .map((tag) => {
76
+ var _a;
69
77
  // Map info object to tag
70
78
  const taggedInfoObject = intros.find((i) => i.tags ? i.tags.includes(tag) : undefined);
71
79
  const tagObject = tags.flat().find((t) => {
72
80
  var _a;
73
- return (_a = (tag === t.name || tag === t["x-displayName"])) !== null && _a !== void 0 ? _a : {
81
+ return (_a = tag === t.name) !== null && _a !== void 0 ? _a : {
74
82
  name: tag,
75
83
  description: `${tag} Index`,
76
84
  };
@@ -105,7 +113,7 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
105
113
  }
106
114
  return {
107
115
  type: "category",
108
- label: tag,
116
+ label: (_a = tagObject === null || tagObject === void 0 ? void 0 : tagObject["x-displayName"]) !== null && _a !== void 0 ? _a : tag,
109
117
  link: linkConfig,
110
118
  collapsible: sidebarCollapsible,
111
119
  collapsed: sidebarCollapsed,
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": "1.1.3",
4
+ "version": "1.1.6",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -67,5 +67,5 @@
67
67
  "engines": {
68
68
  "node": ">=14"
69
69
  },
70
- "gitHead": "4897267289b035aed8155f6001e14c80ba9003a8"
70
+ "gitHead": "fbac87dcd52678751a3fe73ab416e4778e77bbb1"
71
71
  }
@@ -5,13 +5,20 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import { createSchemaDetails } from "./createSchemaDetails";
8
+ import { MediaTypeObject } from "../openapi/types";
9
+ import { createRequestSchema } from "./createRequestSchema";
9
10
 
10
11
  interface Props {
11
12
  title: string;
12
- body: any;
13
+ body: {
14
+ content?: {
15
+ [key: string]: MediaTypeObject;
16
+ };
17
+ description?: string;
18
+ required?: boolean;
19
+ };
13
20
  }
14
21
 
15
- export function createRequestBodyDetails({ title, body }: Props) {
16
- return createSchemaDetails({ title, body });
22
+ export function createRequestBodyDetails({ title, body }: Props): any {
23
+ return createRequestSchema({ title, body });
17
24
  }