docusaurus-plugin-openapi-docs 0.0.0-1000
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/LICENSE +21 -0
- package/README.md +361 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +709 -0
- package/lib/markdown/createArrayBracket.d.ts +2 -0
- package/lib/markdown/createArrayBracket.js +36 -0
- package/lib/markdown/createAuthentication.d.ts +2 -0
- package/lib/markdown/createAuthentication.js +171 -0
- package/lib/markdown/createAuthorization.d.ts +1 -0
- package/lib/markdown/createAuthorization.js +15 -0
- package/lib/markdown/createCallbackMethodEndpoint.d.ts +1 -0
- package/lib/markdown/createCallbackMethodEndpoint.js +20 -0
- package/lib/markdown/createCallbacks.d.ts +6 -0
- package/lib/markdown/createCallbacks.js +77 -0
- package/lib/markdown/createContactInfo.d.ts +2 -0
- package/lib/markdown/createContactInfo.js +39 -0
- package/lib/markdown/createDeprecationNotice.d.ts +6 -0
- package/lib/markdown/createDeprecationNotice.js +20 -0
- package/lib/markdown/createDescription.d.ts +1 -0
- package/lib/markdown/createDescription.js +13 -0
- package/lib/markdown/createDetails.d.ts +2 -0
- package/lib/markdown/createDetails.js +17 -0
- package/lib/markdown/createDetailsSummary.d.ts +2 -0
- package/lib/markdown/createDetailsSummary.js +17 -0
- package/lib/markdown/createDownload.d.ts +1 -0
- package/lib/markdown/createDownload.js +16 -0
- package/lib/markdown/createHeading.d.ts +1 -0
- package/lib/markdown/createHeading.js +20 -0
- package/lib/markdown/createLicense.d.ts +2 -0
- package/lib/markdown/createLicense.js +32 -0
- package/lib/markdown/createLogo.d.ts +2 -0
- package/lib/markdown/createLogo.js +18 -0
- package/lib/markdown/createMethodEndpoint.d.ts +1 -0
- package/lib/markdown/createMethodEndpoint.js +20 -0
- package/lib/markdown/createParamsDetails.d.ts +6 -0
- package/lib/markdown/createParamsDetails.js +18 -0
- package/lib/markdown/createRequestBodyDetails.d.ts +13 -0
- package/lib/markdown/createRequestBodyDetails.js +13 -0
- package/lib/markdown/createRequestHeader.d.ts +1 -0
- package/lib/markdown/createRequestHeader.js +21 -0
- package/lib/markdown/createRequestSchema.d.ts +14 -0
- package/lib/markdown/createRequestSchema.js +20 -0
- package/lib/markdown/createResponseSchema.d.ts +14 -0
- package/lib/markdown/createResponseSchema.js +20 -0
- package/lib/markdown/createSchema.d.ts +9 -0
- package/lib/markdown/createSchema.js +668 -0
- package/lib/markdown/createSchema.test.d.ts +1 -0
- package/lib/markdown/createSchema.test.js +913 -0
- package/lib/markdown/createStatusCodes.d.ts +9 -0
- package/lib/markdown/createStatusCodes.js +63 -0
- package/lib/markdown/createTermsOfService.d.ts +1 -0
- package/lib/markdown/createTermsOfService.js +31 -0
- package/lib/markdown/createVendorExtensions.d.ts +1 -0
- package/lib/markdown/createVendorExtensions.js +24 -0
- package/lib/markdown/createVersionBadge.d.ts +1 -0
- package/lib/markdown/createVersionBadge.js +19 -0
- package/lib/markdown/index.d.ts +5 -0
- package/lib/markdown/index.js +92 -0
- package/lib/markdown/schema.d.ts +3 -0
- package/lib/markdown/schema.js +154 -0
- package/lib/markdown/schema.test.d.ts +1 -0
- package/lib/markdown/schema.test.js +181 -0
- package/lib/markdown/utils.d.ts +20 -0
- package/lib/markdown/utils.js +68 -0
- package/lib/openapi/createRequestExample.d.ts +2 -0
- package/lib/openapi/createRequestExample.js +191 -0
- package/lib/openapi/createResponseExample.d.ts +2 -0
- package/lib/openapi/createResponseExample.js +192 -0
- package/lib/openapi/index.d.ts +1 -0
- package/lib/openapi/index.js +12 -0
- package/lib/openapi/openapi.d.ts +12 -0
- package/lib/openapi/openapi.js +544 -0
- package/lib/openapi/openapi.test.d.ts +1 -0
- package/lib/openapi/openapi.test.js +33 -0
- package/lib/openapi/types.d.ts +354 -0
- package/lib/openapi/types.js +8 -0
- package/lib/openapi/utils/loadAndResolveSpec.d.ts +2 -0
- package/lib/openapi/utils/loadAndResolveSpec.js +153 -0
- package/lib/openapi/utils/services/OpenAPIParser.d.ts +52 -0
- package/lib/openapi/utils/services/OpenAPIParser.js +343 -0
- package/lib/openapi/utils/services/RedocNormalizedOptions.d.ts +100 -0
- package/lib/openapi/utils/services/RedocNormalizedOptions.js +170 -0
- package/lib/openapi/utils/types/index.d.ts +2 -0
- package/lib/openapi/utils/types/index.js +23 -0
- package/lib/openapi/utils/types/open-api.d.ts +305 -0
- package/lib/openapi/utils/types/open-api.js +8 -0
- package/lib/openapi/utils/types.d.ts +306 -0
- package/lib/openapi/utils/types.js +8 -0
- package/lib/openapi/utils/utils/JsonPointer.d.ts +51 -0
- package/lib/openapi/utils/utils/JsonPointer.js +95 -0
- package/lib/openapi/utils/utils/helpers.d.ts +43 -0
- package/lib/openapi/utils/utils/helpers.js +230 -0
- package/lib/openapi/utils/utils/index.d.ts +3 -0
- package/lib/openapi/utils/utils/index.js +25 -0
- package/lib/openapi/utils/utils/openapi.d.ts +40 -0
- package/lib/openapi/utils/utils/openapi.js +605 -0
- package/lib/options.d.ts +2 -0
- package/lib/options.js +69 -0
- package/lib/sidebars/index.d.ts +4 -0
- package/lib/sidebars/index.js +226 -0
- package/lib/sidebars/utils.d.ts +2 -0
- package/lib/sidebars/utils.js +30 -0
- package/lib/types.d.ts +135 -0
- package/lib/types.js +8 -0
- package/package.json +69 -0
- package/src/index.ts +945 -0
- package/src/markdown/__snapshots__/createSchema.test.ts.snap +1605 -0
- package/src/markdown/createArrayBracket.ts +35 -0
- package/src/markdown/createAuthentication.ts +201 -0
- package/src/markdown/createAuthorization.ts +13 -0
- package/src/markdown/createCallbackMethodEndpoint.ts +19 -0
- package/src/markdown/createCallbacks.ts +101 -0
- package/src/markdown/createContactInfo.ts +41 -0
- package/src/markdown/createDeprecationNotice.ts +31 -0
- package/src/markdown/createDescription.ts +12 -0
- package/src/markdown/createDetails.ts +16 -0
- package/src/markdown/createDetailsSummary.ts +16 -0
- package/src/markdown/createDownload.ts +15 -0
- package/src/markdown/createHeading.ts +23 -0
- package/src/markdown/createLicense.ts +34 -0
- package/src/markdown/createLogo.ts +21 -0
- package/src/markdown/createMethodEndpoint.ts +19 -0
- package/src/markdown/createParamsDetails.ts +22 -0
- package/src/markdown/createRequestBodyDetails.ts +24 -0
- package/src/markdown/createRequestHeader.ts +24 -0
- package/src/markdown/createRequestSchema.ts +32 -0
- package/src/markdown/createResponseSchema.ts +32 -0
- package/src/markdown/createSchema.test.ts +1075 -0
- package/src/markdown/createSchema.ts +862 -0
- package/src/markdown/createStatusCodes.ts +63 -0
- package/src/markdown/createTermsOfService.ts +30 -0
- package/src/markdown/createVendorExtensions.ts +22 -0
- package/src/markdown/createVersionBadge.ts +22 -0
- package/src/markdown/index.ts +144 -0
- package/src/markdown/schema.test.ts +208 -0
- package/src/markdown/schema.ts +185 -0
- package/src/markdown/utils.ts +89 -0
- package/src/openapi/__fixtures__/examples/openapi.yaml +49 -0
- package/src/openapi/createRequestExample.ts +235 -0
- package/src/openapi/createResponseExample.ts +238 -0
- package/src/openapi/index.ts +8 -0
- package/src/openapi/openapi.test.ts +40 -0
- package/src/openapi/openapi.ts +697 -0
- package/src/openapi/types.ts +455 -0
- package/src/openapi/utils/loadAndResolveSpec.ts +171 -0
- package/src/openapi/utils/services/OpenAPIParser.ts +434 -0
- package/src/openapi/utils/services/RedocNormalizedOptions.ts +330 -0
- package/src/openapi/utils/types/index.ts +10 -0
- package/src/openapi/utils/types/open-api.ts +303 -0
- package/src/openapi/utils/types.ts +303 -0
- package/src/openapi/utils/utils/JsonPointer.ts +99 -0
- package/src/openapi/utils/utils/helpers.ts +239 -0
- package/src/openapi/utils/utils/index.ts +11 -0
- package/src/openapi/utils/utils/openapi.ts +771 -0
- package/src/openapi-to-postmanv2.d.ts +10 -0
- package/src/options.ts +77 -0
- package/src/plugin-content-docs-types.d.ts +42 -0
- package/src/plugin-openapi.d.ts +87 -0
- package/src/postman-collection.d.ts +10 -0
- package/src/sidebars/index.ts +322 -0
- package/src/sidebars/utils.ts +29 -0
- package/src/types.ts +176 -0
- package/tsconfig.json +7 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { SidebarItemDoc } from "@docusaurus/plugin-content-docs/src/sidebars/types";
|
|
9
|
+
import type Request from "postman-collection";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
InfoObject,
|
|
13
|
+
OperationObject,
|
|
14
|
+
SchemaObject,
|
|
15
|
+
SecuritySchemeObject,
|
|
16
|
+
TagObject,
|
|
17
|
+
} from "./openapi/types";
|
|
18
|
+
|
|
19
|
+
export type {
|
|
20
|
+
PropSidebarItemCategory,
|
|
21
|
+
SidebarItemLink,
|
|
22
|
+
PropSidebar,
|
|
23
|
+
PropSidebarItem,
|
|
24
|
+
} from "@docusaurus/plugin-content-docs-types";
|
|
25
|
+
export interface PluginOptions {
|
|
26
|
+
id?: string;
|
|
27
|
+
docsPlugin?: string;
|
|
28
|
+
docsPluginId: string;
|
|
29
|
+
config: {
|
|
30
|
+
[key: string]: APIOptions;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface APIOptions {
|
|
35
|
+
specPath: string;
|
|
36
|
+
outputDir: string;
|
|
37
|
+
template?: string;
|
|
38
|
+
infoTemplate?: string;
|
|
39
|
+
tagTemplate?: string;
|
|
40
|
+
schemaTemplate?: string;
|
|
41
|
+
downloadUrl?: string;
|
|
42
|
+
hideSendButton?: boolean;
|
|
43
|
+
showExtensions?: boolean;
|
|
44
|
+
sidebarOptions?: SidebarOptions;
|
|
45
|
+
version?: string;
|
|
46
|
+
label?: string;
|
|
47
|
+
baseUrl?: string;
|
|
48
|
+
versions?: {
|
|
49
|
+
[key: string]: APIVersionOptions;
|
|
50
|
+
};
|
|
51
|
+
proxy?: string;
|
|
52
|
+
markdownGenerators?: MarkdownGenerator;
|
|
53
|
+
showSchemas?: boolean;
|
|
54
|
+
disableCompression?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface MarkdownGenerator {
|
|
58
|
+
createApiPageMD?: (pageData: ApiPageMetadata) => string;
|
|
59
|
+
createInfoPageMD?: (pageData: InfoPageMetadata) => string;
|
|
60
|
+
createTagPageMD?: (pageData: TagPageMetadata) => string;
|
|
61
|
+
createSchemaPageMD?: (pageData: SchemaPageMetadata) => string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ApiDocItemGenerator = (
|
|
65
|
+
item: ApiPageMetadata | SchemaPageMetadata,
|
|
66
|
+
context: { sidebarOptions: SidebarOptions; basePath: string }
|
|
67
|
+
) => SidebarItemDoc;
|
|
68
|
+
|
|
69
|
+
export interface SidebarGenerators {
|
|
70
|
+
createDocItem?: ApiDocItemGenerator;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface SidebarOptions {
|
|
74
|
+
groupPathsBy?: string;
|
|
75
|
+
categoryLinkSource?: "info" | "tag" | "auto";
|
|
76
|
+
customProps?: { [key: string]: unknown };
|
|
77
|
+
sidebarCollapsible?: boolean;
|
|
78
|
+
sidebarCollapsed?: boolean;
|
|
79
|
+
sidebarGenerators?: SidebarGenerators;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface APIVersionOptions {
|
|
83
|
+
specPath: string;
|
|
84
|
+
outputDir: string;
|
|
85
|
+
label: string;
|
|
86
|
+
baseUrl: string;
|
|
87
|
+
downloadUrl?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface LoadedContent {
|
|
91
|
+
loadedApi: ApiMetadata[];
|
|
92
|
+
// loadedDocs: DocPageMetadata[]; TODO: cleanup
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type ApiMetadata =
|
|
96
|
+
| ApiPageMetadata
|
|
97
|
+
| InfoPageMetadata
|
|
98
|
+
| TagPageMetadata
|
|
99
|
+
| SchemaPageMetadata;
|
|
100
|
+
|
|
101
|
+
export interface ApiMetadataBase {
|
|
102
|
+
sidebar?: string;
|
|
103
|
+
previous?: ApiNavLink;
|
|
104
|
+
next?: ApiNavLink;
|
|
105
|
+
//
|
|
106
|
+
id: string; // TODO legacy versioned id => try to remove
|
|
107
|
+
unversionedId: string; // TODO new unversioned id => try to rename to "id"
|
|
108
|
+
infoId?: string;
|
|
109
|
+
infoPath?: string;
|
|
110
|
+
downloadUrl?: string;
|
|
111
|
+
title: string;
|
|
112
|
+
description: string;
|
|
113
|
+
source: string; // @site aliased source => "@site/docs/folder/subFolder/subSubFolder/myDoc.md"
|
|
114
|
+
sourceDirName: string; // relative to the versioned docs folder (can be ".") => "folder/subFolder/subSubFolder"
|
|
115
|
+
slug?: string;
|
|
116
|
+
permalink: string;
|
|
117
|
+
sidebarPosition?: number;
|
|
118
|
+
frontMatter: Record<string, unknown>;
|
|
119
|
+
method?: string;
|
|
120
|
+
path?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ApiPageMetadata extends ApiMetadataBase {
|
|
124
|
+
json?: string;
|
|
125
|
+
type: "api";
|
|
126
|
+
api: ApiItem;
|
|
127
|
+
markdown?: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface ApiItem extends OperationObject {
|
|
131
|
+
method: string; // get, post, put, etc...
|
|
132
|
+
path: string; // The endpoint path => "/api/getPets"
|
|
133
|
+
jsonRequestBodyExample: string;
|
|
134
|
+
securitySchemes?: {
|
|
135
|
+
[key: string]: SecuritySchemeObject;
|
|
136
|
+
};
|
|
137
|
+
postman?: Request;
|
|
138
|
+
proxy?: string;
|
|
139
|
+
info: InfoObject;
|
|
140
|
+
extensions?: object;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface InfoPageMetadata extends ApiMetadataBase {
|
|
144
|
+
type: "info";
|
|
145
|
+
info: ApiInfo;
|
|
146
|
+
markdown?: string;
|
|
147
|
+
securitySchemes?: {
|
|
148
|
+
[key: string]: SecuritySchemeObject;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface TagPageMetadata extends ApiMetadataBase {
|
|
153
|
+
type: "tag";
|
|
154
|
+
tag: TagObject;
|
|
155
|
+
markdown?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface SchemaPageMetadata extends ApiMetadataBase {
|
|
159
|
+
type: "schema";
|
|
160
|
+
schema: SchemaObject;
|
|
161
|
+
markdown?: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface TagGroupPageMetadata extends ApiMetadataBase {
|
|
165
|
+
type: "tagGroup";
|
|
166
|
+
name: string;
|
|
167
|
+
tags: TagObject[];
|
|
168
|
+
markdown?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type ApiInfo = InfoObject;
|
|
172
|
+
|
|
173
|
+
export interface ApiNavLink {
|
|
174
|
+
title: string;
|
|
175
|
+
permalink: string;
|
|
176
|
+
}
|