docusaurus-plugin-openapi-docs 1.1.4 → 1.1.7
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/createResponseSchema.d.ts +14 -0
- package/lib/markdown/createResponseSchema.js +641 -0
- package/lib/markdown/createSchemaDetails.d.ts +1 -1
- package/lib/markdown/createSchemaDetails.js +116 -42
- 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 -3
- package/src/markdown/createRequestBodyDetails.ts +11 -4
- package/src/markdown/createRequestSchema.ts +848 -0
- package/src/markdown/{createSchemaDetails.ts → createResponseSchema.ts} +128 -73
- 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/LICENSE +0 -21
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 = [];
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Palo Alto Networks
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|