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.
- package/lib/markdown/createRequestBodyDetails.d.ts +9 -2
- package/lib/markdown/createRequestBodyDetails.js +2 -2
- package/lib/markdown/createRequestSchema.d.ts +21 -0
- package/lib/markdown/createRequestSchema.js +680 -0
- package/lib/markdown/{createSchemaDetails.d.ts → createResponseSchema.d.ts} +2 -2
- package/lib/markdown/{createSchemaDetails.js → createResponseSchema.js} +110 -63
- package/lib/markdown/createStatusCodes.d.ts +2 -0
- package/lib/markdown/createStatusCodes.js +58 -56
- package/lib/markdown/index.js +5 -1
- package/lib/openapi/createExample.js +27 -14
- package/lib/openapi/openapi.d.ts +1 -1
- package/lib/openapi/openapi.js +21 -10
- package/lib/openapi/types.d.ts +1 -1
- package/lib/sidebars/index.d.ts +1 -1
- package/lib/sidebars/index.js +11 -3
- package/package.json +2 -2
- package/src/markdown/createRequestBodyDetails.ts +11 -4
- package/src/markdown/createRequestSchema.ts +848 -0
- package/src/markdown/{createSchemaDetails.ts → createResponseSchema.ts} +134 -72
- package/src/markdown/createStatusCodes.ts +53 -61
- package/src/markdown/index.ts +17 -1
- package/src/openapi/createExample.ts +31 -14
- package/src/openapi/openapi.ts +16 -8
- package/src/openapi/types.ts +1 -1
- package/src/sidebars/index.ts +13 -5
package/src/sidebars/index.ts
CHANGED
|
@@ -37,7 +37,7 @@ function groupByTags(
|
|
|
37
37
|
items: ApiPageMetadata[],
|
|
38
38
|
sidebarOptions: SidebarOptions,
|
|
39
39
|
options: APIOptions,
|
|
40
|
-
tags: TagObject[],
|
|
40
|
+
tags: TagObject[][],
|
|
41
41
|
docPath: string
|
|
42
42
|
): ProcessedSidebar {
|
|
43
43
|
const { outputDir, label } = options;
|
|
@@ -60,12 +60,20 @@ function groupByTags(
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
// TODO: make sure we only take the first tag
|
|
63
|
-
const
|
|
63
|
+
const operationTags = uniq(
|
|
64
64
|
apiItems
|
|
65
65
|
.flatMap((item) => item.api.tags)
|
|
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[] = [];
|
|
71
|
+
tags.flat().forEach((tag) => {
|
|
72
|
+
if (operationTags.includes(tag.name!)) {
|
|
73
|
+
apiTags.push(tag.name!);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
69
77
|
const basePath = docPath
|
|
70
78
|
? outputDir.split(docPath!)[1].replace(/^\/+/g, "")
|
|
71
79
|
: outputDir.slice(outputDir.indexOf("/", 1)).replace(/^\/+/g, "");
|
|
@@ -107,7 +115,7 @@ function groupByTags(
|
|
|
107
115
|
);
|
|
108
116
|
const tagObject = tags.flat().find(
|
|
109
117
|
(t) =>
|
|
110
|
-
|
|
118
|
+
tag === t.name ?? {
|
|
111
119
|
name: tag,
|
|
112
120
|
description: `${tag} Index`,
|
|
113
121
|
}
|
|
@@ -148,7 +156,7 @@ function groupByTags(
|
|
|
148
156
|
|
|
149
157
|
return {
|
|
150
158
|
type: "category" as const,
|
|
151
|
-
label: tag,
|
|
159
|
+
label: tagObject?.["x-displayName"] ?? tag,
|
|
152
160
|
link: linkConfig,
|
|
153
161
|
collapsible: sidebarCollapsible,
|
|
154
162
|
collapsed: sidebarCollapsed,
|
|
@@ -191,7 +199,7 @@ export default function generateSidebarSlice(
|
|
|
191
199
|
sidebarOptions: SidebarOptions,
|
|
192
200
|
options: APIOptions,
|
|
193
201
|
api: ApiMetadata[],
|
|
194
|
-
tags: TagObject[],
|
|
202
|
+
tags: TagObject[][],
|
|
195
203
|
docPath: string
|
|
196
204
|
) {
|
|
197
205
|
let sidebarSlice: ProcessedSidebar = [];
|