docusaurus-plugin-openapi-docs 0.0.0-348 → 0.0.0-351
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.d.ts +3 -0
- package/lib/index.js +194 -0
- package/lib/markdown/createContactInfo.d.ts +2 -0
- package/lib/markdown/createContactInfo.js +49 -0
- package/lib/markdown/createDeprecationNotice.d.ts +6 -0
- package/lib/markdown/createDeprecationNotice.js +19 -0
- package/lib/markdown/createDescription.d.ts +1 -0
- package/lib/markdown/createDescription.js +16 -0
- package/lib/markdown/createDetails.d.ts +2 -0
- package/lib/markdown/createDetails.js +18 -0
- package/lib/markdown/createDetailsSummary.d.ts +2 -0
- package/lib/markdown/createDetailsSummary.js +18 -0
- package/lib/markdown/createLicense.d.ts +2 -0
- package/lib/markdown/createLicense.js +33 -0
- package/lib/markdown/createParamsDetails.d.ts +7 -0
- package/lib/markdown/createParamsDetails.js +44 -0
- package/lib/markdown/createRequestBodyDetails.d.ts +6 -0
- package/lib/markdown/createRequestBodyDetails.js +14 -0
- package/lib/markdown/createSchemaDetails.d.ts +14 -0
- package/lib/markdown/createSchemaDetails.js +244 -0
- package/lib/markdown/createStatusCodes.d.ts +6 -0
- package/lib/markdown/createStatusCodes.js +47 -0
- package/lib/markdown/createTermsOfService.d.ts +1 -0
- package/lib/markdown/createTermsOfService.js +32 -0
- package/lib/markdown/createVersionBadge.d.ts +1 -0
- package/lib/markdown/createVersionBadge.js +20 -0
- package/lib/markdown/index.d.ts +3 -0
- package/lib/markdown/index.js +49 -0
- package/lib/markdown/schema.d.ts +3 -0
- package/lib/markdown/schema.js +100 -0
- package/lib/markdown/schema.test.d.ts +1 -0
- package/lib/markdown/schema.test.js +171 -0
- package/lib/markdown/utils.d.ts +7 -0
- package/lib/markdown/utils.js +33 -0
- package/lib/openapi/createExample.d.ts +2 -0
- package/lib/openapi/createExample.js +113 -0
- package/lib/openapi/index.d.ts +1 -0
- package/lib/openapi/index.js +12 -0
- package/lib/openapi/openapi.d.ts +11 -0
- package/lib/openapi/openapi.js +231 -0
- package/lib/openapi/openapi.test.d.ts +1 -0
- package/lib/openapi/openapi.test.js +33 -0
- package/lib/openapi/types.d.ts +334 -0
- package/{src/markdown/createRequestBodyTable.ts → lib/openapi/types.js} +2 -11
- package/lib/options.d.ts +4 -0
- package/lib/options.js +18 -0
- package/lib/sidebars/index.d.ts +3 -0
- package/lib/sidebars/index.js +89 -0
- package/lib/types.d.ts +68 -0
- package/{src/markdown/createFullWidthTable.ts → lib/types.js} +2 -10
- package/package.json +2 -2
- package/src/markdown/createContactInfo.ts +48 -0
- package/src/markdown/createLicense.ts +32 -0
- package/src/markdown/createTermsOfService.ts +30 -0
- package/src/markdown/index.ts +8 -1
- package/src/openapi/types.ts +2 -0
- package/src/markdown/createParamsTable.ts +0 -102
- package/src/markdown/createSchemaTable.ts +0 -275
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import type { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
|
|
2
|
+
interface Map<T> {
|
|
3
|
+
[key: string]: T;
|
|
4
|
+
}
|
|
5
|
+
export interface OpenApiObject {
|
|
6
|
+
openapi: string;
|
|
7
|
+
info: InfoObject;
|
|
8
|
+
servers?: ServerObject[];
|
|
9
|
+
paths: PathsObject;
|
|
10
|
+
components?: ComponentsObject;
|
|
11
|
+
security?: SecurityRequirementObject[];
|
|
12
|
+
tags?: TagObject[];
|
|
13
|
+
externalDocs?: ExternalDocumentationObject;
|
|
14
|
+
}
|
|
15
|
+
export interface OpenApiObjectWithRef {
|
|
16
|
+
openapi: string;
|
|
17
|
+
info: InfoObject;
|
|
18
|
+
servers?: ServerObject[];
|
|
19
|
+
paths: PathsObjectWithRef;
|
|
20
|
+
components?: ComponentsObjectWithRef;
|
|
21
|
+
security?: SecurityRequirementObject[];
|
|
22
|
+
tags?: TagObject[];
|
|
23
|
+
externalDocs?: ExternalDocumentationObject;
|
|
24
|
+
}
|
|
25
|
+
export interface InfoObject {
|
|
26
|
+
title: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
termsOfService?: string;
|
|
29
|
+
contact?: ContactObject;
|
|
30
|
+
license?: LicenseObject;
|
|
31
|
+
version: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ContactObject {
|
|
34
|
+
name?: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface LicenseObject {
|
|
39
|
+
name: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ServerObject {
|
|
43
|
+
url: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
variables?: Map<ServerVariable>;
|
|
46
|
+
}
|
|
47
|
+
export interface ServerVariable {
|
|
48
|
+
enum?: string[];
|
|
49
|
+
default: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ComponentsObject {
|
|
53
|
+
schemas?: Map<SchemaObject>;
|
|
54
|
+
responses?: Map<ResponseObject>;
|
|
55
|
+
parameters?: Map<ParameterObject>;
|
|
56
|
+
examples?: Map<ExampleObject>;
|
|
57
|
+
requestBodies?: Map<RequestBodyObject>;
|
|
58
|
+
headers?: Map<HeaderObject>;
|
|
59
|
+
securitySchemes?: Map<SecuritySchemeObject>;
|
|
60
|
+
links?: Map<LinkObject>;
|
|
61
|
+
callbacks?: Map<CallbackObject>;
|
|
62
|
+
}
|
|
63
|
+
export interface ComponentsObjectWithRef {
|
|
64
|
+
schemas?: Map<SchemaObjectWithRef | ReferenceObject>;
|
|
65
|
+
responses?: Map<ResponseObjectWithRef | ReferenceObject>;
|
|
66
|
+
parameters?: Map<ParameterObjectWithRef | ReferenceObject>;
|
|
67
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
68
|
+
requestBodies?: Map<RequestBodyObjectWithRef | ReferenceObject>;
|
|
69
|
+
headers?: Map<HeaderObjectWithRef | ReferenceObject>;
|
|
70
|
+
securitySchemes?: Map<SecuritySchemeObject | ReferenceObject>;
|
|
71
|
+
links?: Map<LinkObject | ReferenceObject>;
|
|
72
|
+
callbacks?: Map<CallbackObjectWithRef | ReferenceObject>;
|
|
73
|
+
}
|
|
74
|
+
export declare type PathsObject = Map<PathItemObject>;
|
|
75
|
+
export declare type PathsObjectWithRef = Map<PathItemObjectWithRef>;
|
|
76
|
+
export interface PathItemObject {
|
|
77
|
+
$ref?: string;
|
|
78
|
+
summary?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
get?: OperationObject;
|
|
81
|
+
put?: OperationObject;
|
|
82
|
+
post?: OperationObject;
|
|
83
|
+
delete?: OperationObject;
|
|
84
|
+
options?: OperationObject;
|
|
85
|
+
head?: OperationObject;
|
|
86
|
+
patch?: OperationObject;
|
|
87
|
+
trace?: OperationObject;
|
|
88
|
+
servers?: ServerObject[];
|
|
89
|
+
parameters?: ParameterObject[];
|
|
90
|
+
}
|
|
91
|
+
export interface PathItemObjectWithRef {
|
|
92
|
+
$ref?: string;
|
|
93
|
+
summary?: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
get?: OperationObjectWithRef;
|
|
96
|
+
put?: OperationObjectWithRef;
|
|
97
|
+
post?: OperationObjectWithRef;
|
|
98
|
+
delete?: OperationObjectWithRef;
|
|
99
|
+
options?: OperationObjectWithRef;
|
|
100
|
+
head?: OperationObjectWithRef;
|
|
101
|
+
patch?: OperationObjectWithRef;
|
|
102
|
+
trace?: OperationObjectWithRef;
|
|
103
|
+
servers?: ServerObject[];
|
|
104
|
+
parameters?: (ParameterObjectWithRef | ReferenceObject)[];
|
|
105
|
+
}
|
|
106
|
+
export interface OperationObject {
|
|
107
|
+
tags?: string[];
|
|
108
|
+
summary?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
externalDocs?: ExternalDocumentationObject;
|
|
111
|
+
operationId?: string;
|
|
112
|
+
parameters?: ParameterObject[];
|
|
113
|
+
requestBody?: RequestBodyObject;
|
|
114
|
+
responses: ResponsesObject;
|
|
115
|
+
callbacks?: Map<CallbackObject>;
|
|
116
|
+
deprecated?: boolean;
|
|
117
|
+
security?: SecurityRequirementObject[];
|
|
118
|
+
servers?: ServerObject[];
|
|
119
|
+
"x-deprecated-description"?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface OperationObjectWithRef {
|
|
122
|
+
tags?: string[];
|
|
123
|
+
summary?: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
externalDocs?: ExternalDocumentationObject;
|
|
126
|
+
operationId?: string;
|
|
127
|
+
parameters?: (ParameterObjectWithRef | ReferenceObject)[];
|
|
128
|
+
requestBody?: RequestBodyObjectWithRef | ReferenceObject;
|
|
129
|
+
responses: ResponsesObjectWithRef;
|
|
130
|
+
callbacks?: Map<CallbackObjectWithRef | ReferenceObject>;
|
|
131
|
+
deprecated?: boolean;
|
|
132
|
+
security?: SecurityRequirementObject[];
|
|
133
|
+
servers?: ServerObject[];
|
|
134
|
+
"x-deprecated-description"?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface ExternalDocumentationObject {
|
|
137
|
+
description?: string;
|
|
138
|
+
url: string;
|
|
139
|
+
}
|
|
140
|
+
export interface ParameterObject {
|
|
141
|
+
name: string;
|
|
142
|
+
in: "query" | "header" | "path" | "cookie";
|
|
143
|
+
description?: string;
|
|
144
|
+
required?: boolean;
|
|
145
|
+
deprecated?: boolean;
|
|
146
|
+
allowEmptyValue?: boolean;
|
|
147
|
+
style?: string;
|
|
148
|
+
explode?: string;
|
|
149
|
+
allowReserved?: boolean;
|
|
150
|
+
schema?: SchemaObject;
|
|
151
|
+
example?: any;
|
|
152
|
+
examples?: Map<ExampleObject>;
|
|
153
|
+
content?: Map<MediaTypeObject>;
|
|
154
|
+
param?: Object;
|
|
155
|
+
}
|
|
156
|
+
export interface ParameterObjectWithRef {
|
|
157
|
+
name: string;
|
|
158
|
+
in: string;
|
|
159
|
+
description?: string;
|
|
160
|
+
required?: boolean;
|
|
161
|
+
deprecated?: boolean;
|
|
162
|
+
allowEmptyValue?: boolean;
|
|
163
|
+
style?: string;
|
|
164
|
+
explode?: string;
|
|
165
|
+
allowReserved?: boolean;
|
|
166
|
+
schema?: SchemaObjectWithRef | ReferenceObject;
|
|
167
|
+
example?: any;
|
|
168
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
169
|
+
content?: Map<MediaTypeObjectWithRef>;
|
|
170
|
+
}
|
|
171
|
+
export interface RequestBodyObject {
|
|
172
|
+
description?: string;
|
|
173
|
+
content: Map<MediaTypeObject>;
|
|
174
|
+
required?: boolean;
|
|
175
|
+
}
|
|
176
|
+
export interface RequestBodyObjectWithRef {
|
|
177
|
+
description?: string;
|
|
178
|
+
content: Map<MediaTypeObjectWithRef>;
|
|
179
|
+
required?: boolean;
|
|
180
|
+
}
|
|
181
|
+
export interface MediaTypeObject {
|
|
182
|
+
schema?: SchemaObject;
|
|
183
|
+
example?: any;
|
|
184
|
+
examples?: Map<ExampleObject>;
|
|
185
|
+
encoding?: Map<EncodingObject>;
|
|
186
|
+
}
|
|
187
|
+
export interface MediaTypeObjectWithRef {
|
|
188
|
+
schema?: SchemaObjectWithRef | ReferenceObject;
|
|
189
|
+
example?: any;
|
|
190
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
191
|
+
encoding?: Map<EncodingObjectWithRef>;
|
|
192
|
+
}
|
|
193
|
+
export interface EncodingObject {
|
|
194
|
+
contentType?: string;
|
|
195
|
+
headers?: Map<HeaderObject>;
|
|
196
|
+
style?: string;
|
|
197
|
+
explode?: boolean;
|
|
198
|
+
allowReserved?: boolean;
|
|
199
|
+
}
|
|
200
|
+
export interface EncodingObjectWithRef {
|
|
201
|
+
contentType?: string;
|
|
202
|
+
headers?: Map<HeaderObjectWithRef | ReferenceObject>;
|
|
203
|
+
style?: string;
|
|
204
|
+
explode?: boolean;
|
|
205
|
+
allowReserved?: boolean;
|
|
206
|
+
}
|
|
207
|
+
export declare type ResponsesObject = Map<ResponseObject>;
|
|
208
|
+
export declare type ResponsesObjectWithRef = Map<ResponseObjectWithRef | ReferenceObject>;
|
|
209
|
+
export interface ResponseObject {
|
|
210
|
+
description: string;
|
|
211
|
+
headers?: Map<HeaderObject>;
|
|
212
|
+
content?: Map<MediaTypeObject>;
|
|
213
|
+
links?: Map<LinkObject>;
|
|
214
|
+
}
|
|
215
|
+
export interface ResponseObjectWithRef {
|
|
216
|
+
description: string;
|
|
217
|
+
headers?: Map<HeaderObjectWithRef | ReferenceObject>;
|
|
218
|
+
content?: Map<MediaTypeObjectWithRef>;
|
|
219
|
+
links?: Map<LinkObject | ReferenceObject>;
|
|
220
|
+
}
|
|
221
|
+
export declare type CallbackObject = Map<PathItemObject>;
|
|
222
|
+
export declare type CallbackObjectWithRef = Map<PathItemObjectWithRef>;
|
|
223
|
+
export interface ExampleObject {
|
|
224
|
+
summary?: string;
|
|
225
|
+
description?: string;
|
|
226
|
+
value?: any;
|
|
227
|
+
externalValue?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface LinkObject {
|
|
230
|
+
operationRef?: string;
|
|
231
|
+
operationId?: string;
|
|
232
|
+
parameters?: Map<any>;
|
|
233
|
+
requestBody?: any;
|
|
234
|
+
description?: string;
|
|
235
|
+
server?: ServerObject;
|
|
236
|
+
}
|
|
237
|
+
export declare type HeaderObject = Omit<ParameterObject, "name" | "in">;
|
|
238
|
+
export declare type HeaderObjectWithRef = Omit<ParameterObjectWithRef, "name" | "in">;
|
|
239
|
+
export interface TagObject {
|
|
240
|
+
name: string;
|
|
241
|
+
description?: string;
|
|
242
|
+
externalDocs?: ExternalDocumentationObject;
|
|
243
|
+
"x-displayName"?: string;
|
|
244
|
+
}
|
|
245
|
+
export interface ReferenceObject {
|
|
246
|
+
$ref: string;
|
|
247
|
+
}
|
|
248
|
+
export declare type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
249
|
+
export declare type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
250
|
+
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
251
|
+
allOf?: SchemaObject[];
|
|
252
|
+
oneOf?: SchemaObject[];
|
|
253
|
+
anyOf?: SchemaObject[];
|
|
254
|
+
not?: SchemaObject;
|
|
255
|
+
items?: SchemaObject;
|
|
256
|
+
properties?: Map<SchemaObject>;
|
|
257
|
+
additionalProperties?: boolean | SchemaObject;
|
|
258
|
+
nullable?: boolean;
|
|
259
|
+
discriminator?: DiscriminatorObject;
|
|
260
|
+
readOnly?: boolean;
|
|
261
|
+
writeOnly?: boolean;
|
|
262
|
+
xml?: XMLObject;
|
|
263
|
+
externalDocs?: ExternalDocumentationObject;
|
|
264
|
+
example?: any;
|
|
265
|
+
deprecated?: boolean;
|
|
266
|
+
};
|
|
267
|
+
export declare type SchemaObjectWithRef = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
268
|
+
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
269
|
+
allOf?: (SchemaObject | ReferenceObject)[];
|
|
270
|
+
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
271
|
+
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
272
|
+
not?: SchemaObject | ReferenceObject;
|
|
273
|
+
items?: SchemaObject | ReferenceObject;
|
|
274
|
+
properties?: Map<SchemaObject | ReferenceObject>;
|
|
275
|
+
additionalProperties?: boolean | SchemaObject | ReferenceObject;
|
|
276
|
+
nullable?: boolean;
|
|
277
|
+
discriminator?: DiscriminatorObject;
|
|
278
|
+
readOnly?: boolean;
|
|
279
|
+
writeOnly?: boolean;
|
|
280
|
+
xml?: XMLObject;
|
|
281
|
+
externalDocs?: ExternalDocumentationObject;
|
|
282
|
+
example?: any;
|
|
283
|
+
deprecated?: boolean;
|
|
284
|
+
};
|
|
285
|
+
export interface DiscriminatorObject {
|
|
286
|
+
propertyName: string;
|
|
287
|
+
mapping?: Map<string>;
|
|
288
|
+
}
|
|
289
|
+
export interface XMLObject {
|
|
290
|
+
name?: string;
|
|
291
|
+
namespace?: string;
|
|
292
|
+
prefix?: string;
|
|
293
|
+
attribute?: boolean;
|
|
294
|
+
wrapped?: boolean;
|
|
295
|
+
}
|
|
296
|
+
export declare type SecuritySchemeObject = ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject;
|
|
297
|
+
export interface ApiKeySecuritySchemeObject {
|
|
298
|
+
type: "apiKey";
|
|
299
|
+
description?: string;
|
|
300
|
+
name: string;
|
|
301
|
+
in: "query" | "header" | "cookie";
|
|
302
|
+
}
|
|
303
|
+
export interface HttpSecuritySchemeObject {
|
|
304
|
+
type: "http";
|
|
305
|
+
description?: string;
|
|
306
|
+
scheme: string;
|
|
307
|
+
bearerFormat?: string;
|
|
308
|
+
name?: string;
|
|
309
|
+
in?: string;
|
|
310
|
+
}
|
|
311
|
+
export interface Oauth2SecuritySchemeObject {
|
|
312
|
+
type: "oauth2";
|
|
313
|
+
description?: string;
|
|
314
|
+
flows: OAuthFlowsObject;
|
|
315
|
+
}
|
|
316
|
+
export interface OpenIdConnectSecuritySchemeObject {
|
|
317
|
+
type: "openIdConnect";
|
|
318
|
+
description?: string;
|
|
319
|
+
openIdConnectUrl: string;
|
|
320
|
+
}
|
|
321
|
+
export interface OAuthFlowsObject {
|
|
322
|
+
implicit?: OAuthFlowObject;
|
|
323
|
+
password?: OAuthFlowObject;
|
|
324
|
+
clientCredentials?: OAuthFlowObject;
|
|
325
|
+
authorizationCode?: OAuthFlowObject;
|
|
326
|
+
}
|
|
327
|
+
export interface OAuthFlowObject {
|
|
328
|
+
authorizationUrl?: string;
|
|
329
|
+
tokenUrl?: string;
|
|
330
|
+
refreshUrl?: string;
|
|
331
|
+
scopes: Map<string>;
|
|
332
|
+
}
|
|
333
|
+
export declare type SecurityRequirementObject = Map<string[]>;
|
|
334
|
+
export {};
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
import { createSchemaTable } from "./createSchemaTable";
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
title: string;
|
|
12
|
-
body: any;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function createRequestBodyTable({ title, body }: Props) {
|
|
16
|
-
return createSchemaTable({ title, body });
|
|
17
|
-
}
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/options.d.ts
ADDED
package/lib/options.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OptionsSchema = exports.DEFAULT_OPTIONS = void 0;
|
|
10
|
+
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
|
+
exports.DEFAULT_OPTIONS = {
|
|
12
|
+
id: "default",
|
|
13
|
+
config: {},
|
|
14
|
+
};
|
|
15
|
+
exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
16
|
+
id: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.id),
|
|
17
|
+
config: utils_validation_1.Joi.object().default(exports.DEFAULT_OPTIONS.config),
|
|
18
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ProcessedSidebar } from "@docusaurus/plugin-content-docs/src/sidebars/types";
|
|
2
|
+
import type { SidebarOptions, APIOptions, ApiMetadata } from "../types";
|
|
3
|
+
export default function generateSidebarSlice(sidebarOptions: SidebarOptions, options: APIOptions, api: ApiMetadata[]): ProcessedSidebar;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
13
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
14
|
+
function isApiItem(item) {
|
|
15
|
+
return item.type === "api";
|
|
16
|
+
}
|
|
17
|
+
function groupByTags(items, sidebarOptions, options) {
|
|
18
|
+
// TODO: Figure out how to handle these
|
|
19
|
+
// const intros = items.filter(isInfoItem).map((item) => {
|
|
20
|
+
// return {
|
|
21
|
+
// type: "link" as const,
|
|
22
|
+
// label: item.title,
|
|
23
|
+
// href: item.permalink,
|
|
24
|
+
// docId: item.id,
|
|
25
|
+
// };
|
|
26
|
+
// });
|
|
27
|
+
const { outputDir } = options;
|
|
28
|
+
const { sidebarCollapsed, sidebarCollapsible, customProps } = sidebarOptions;
|
|
29
|
+
const apiItems = items.filter(isApiItem);
|
|
30
|
+
// TODO: make sure we only take the first tag
|
|
31
|
+
const tags = (0, uniq_1.default)(apiItems
|
|
32
|
+
.flatMap((item) => item.api.tags)
|
|
33
|
+
.filter((item) => !!item));
|
|
34
|
+
// TODO: optimize this or make it a function
|
|
35
|
+
const basePath = outputDir
|
|
36
|
+
.slice(outputDir.indexOf("/", 1))
|
|
37
|
+
.replace(/^\/+/g, "");
|
|
38
|
+
function createDocItem(item) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const sidebar_label = item.frontMatter.sidebar_label;
|
|
41
|
+
const title = item.title;
|
|
42
|
+
const id = item.id;
|
|
43
|
+
return {
|
|
44
|
+
type: "doc",
|
|
45
|
+
id: `${basePath}/${item.id}`,
|
|
46
|
+
label: (_b = (_a = sidebar_label) !== null && _a !== void 0 ? _a : title) !== null && _b !== void 0 ? _b : id,
|
|
47
|
+
customProps: customProps,
|
|
48
|
+
className: (0, clsx_1.default)({
|
|
49
|
+
"menu__list-item--deprecated": item.api.deprecated,
|
|
50
|
+
"api-method": !!item.api.method,
|
|
51
|
+
}, item.api.method),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const tagged = tags
|
|
55
|
+
.map((tag) => {
|
|
56
|
+
return {
|
|
57
|
+
type: "category",
|
|
58
|
+
label: tag,
|
|
59
|
+
collapsible: sidebarCollapsible,
|
|
60
|
+
collapsed: sidebarCollapsed,
|
|
61
|
+
items: apiItems
|
|
62
|
+
.filter((item) => { var _a; return !!((_a = item.api.tags) === null || _a === void 0 ? void 0 : _a.includes(tag)); })
|
|
63
|
+
.map(createDocItem),
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
.filter((item) => item.items.length > 0); // Filter out any categories with no items.
|
|
67
|
+
// const untagged = [
|
|
68
|
+
// // TODO: determine if needed and how
|
|
69
|
+
// {
|
|
70
|
+
// type: "category" as const,
|
|
71
|
+
// label: "UNTAGGED",
|
|
72
|
+
// // collapsible: options.sidebarCollapsible, TODO: add option
|
|
73
|
+
// // collapsed: options.sidebarCollapsed, TODO: add option
|
|
74
|
+
// items: apiItems
|
|
75
|
+
// //@ts-ignore
|
|
76
|
+
// .filter(({ api }) => api.tags === undefined || api.tags.length === 0)
|
|
77
|
+
// .map(createDocItem),
|
|
78
|
+
// },
|
|
79
|
+
// ];
|
|
80
|
+
return [...tagged];
|
|
81
|
+
}
|
|
82
|
+
function generateSidebarSlice(sidebarOptions, options, api) {
|
|
83
|
+
let sidebarSlice = [];
|
|
84
|
+
if (sidebarOptions.groupPathsBy === "tags") {
|
|
85
|
+
sidebarSlice = groupByTags(api, sidebarOptions, options);
|
|
86
|
+
}
|
|
87
|
+
return sidebarSlice;
|
|
88
|
+
}
|
|
89
|
+
exports.default = generateSidebarSlice;
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type Request from "@paloaltonetworks/postman-collection";
|
|
2
|
+
import { InfoObject, OperationObject, SecuritySchemeObject } from "./openapi/types";
|
|
3
|
+
export type { PropSidebarItemCategory, SidebarItemLink, PropSidebar, PropSidebarItem, } from "@docusaurus/plugin-content-docs-types";
|
|
4
|
+
export interface PluginOptions {
|
|
5
|
+
id?: string;
|
|
6
|
+
config: {
|
|
7
|
+
[key: string]: APIOptions;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface APIOptions {
|
|
11
|
+
specPath: string;
|
|
12
|
+
outputDir: string;
|
|
13
|
+
template?: string;
|
|
14
|
+
sidebarOptions?: SidebarOptions;
|
|
15
|
+
}
|
|
16
|
+
export interface LoadedContent {
|
|
17
|
+
loadedApi: ApiMetadata[];
|
|
18
|
+
}
|
|
19
|
+
export declare type ApiMetadata = ApiPageMetadata | InfoPageMetadata;
|
|
20
|
+
export interface ApiMetadataBase {
|
|
21
|
+
sidebar?: string;
|
|
22
|
+
previous?: ApiNavLink;
|
|
23
|
+
next?: ApiNavLink;
|
|
24
|
+
id: string;
|
|
25
|
+
unversionedId: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
source: string;
|
|
29
|
+
sourceDirName: string;
|
|
30
|
+
slug: string;
|
|
31
|
+
permalink: string;
|
|
32
|
+
sidebarPosition?: number;
|
|
33
|
+
frontMatter: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface ApiPageMetadata extends ApiMetadataBase {
|
|
36
|
+
json?: string;
|
|
37
|
+
type: "api";
|
|
38
|
+
api: ApiItem;
|
|
39
|
+
markdown?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ApiItem extends OperationObject {
|
|
42
|
+
method: string;
|
|
43
|
+
path: string;
|
|
44
|
+
jsonRequestBodyExample: string;
|
|
45
|
+
securitySchemes?: {
|
|
46
|
+
[key: string]: SecuritySchemeObject;
|
|
47
|
+
};
|
|
48
|
+
postman?: Request;
|
|
49
|
+
info: InfoObject;
|
|
50
|
+
}
|
|
51
|
+
export interface InfoPageMetadata extends ApiMetadataBase {
|
|
52
|
+
type: "info";
|
|
53
|
+
info: ApiInfo;
|
|
54
|
+
markdown?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare type ApiInfo = InfoObject;
|
|
57
|
+
export interface ApiNavLink {
|
|
58
|
+
title: string;
|
|
59
|
+
permalink: string;
|
|
60
|
+
}
|
|
61
|
+
export interface SidebarOptions {
|
|
62
|
+
groupPathsBy?: string;
|
|
63
|
+
customProps?: {
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
};
|
|
66
|
+
sidebarCollapsible?: boolean;
|
|
67
|
+
sidebarCollapsed?: boolean;
|
|
68
|
+
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
import { create, Props } from "./utils";
|
|
9
|
-
|
|
10
|
-
export function createFullWidthTable({ children, style, ...rest }: Props) {
|
|
11
|
-
return create("table", {
|
|
12
|
-
style: { display: "table", width: "100%", ...style },
|
|
13
|
-
...rest,
|
|
14
|
-
children,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
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-
|
|
4
|
+
"version": "0.0.0-351",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "475483bcb20b232da5c12ee23c48855dd32ba0d8"
|
|
64
64
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { ContactObject } from "../openapi/types";
|
|
9
|
+
import { create } from "./utils";
|
|
10
|
+
|
|
11
|
+
export function createContactInfo(contact: ContactObject) {
|
|
12
|
+
if (!contact) return "";
|
|
13
|
+
const { name, url, email } = contact;
|
|
14
|
+
|
|
15
|
+
return create("div", {
|
|
16
|
+
style: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
marginBottom: "var(--ifm-paragraph-margin-bottom)",
|
|
20
|
+
},
|
|
21
|
+
children: [
|
|
22
|
+
create("h3", {
|
|
23
|
+
style: {
|
|
24
|
+
marginBottom: "0.25rem",
|
|
25
|
+
},
|
|
26
|
+
children: "Contact",
|
|
27
|
+
}),
|
|
28
|
+
create("span", {
|
|
29
|
+
children: [
|
|
30
|
+
`${name}: `,
|
|
31
|
+
create("a", {
|
|
32
|
+
href: `mailto:${email}`,
|
|
33
|
+
children: `${email}`,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
create("span", {
|
|
38
|
+
children: [
|
|
39
|
+
"URL: ",
|
|
40
|
+
create("a", {
|
|
41
|
+
href: `${url}`,
|
|
42
|
+
children: `${url}`,
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { LicenseObject } from "../openapi/types";
|
|
9
|
+
import { create } from "./utils";
|
|
10
|
+
|
|
11
|
+
export function createLicense(license: LicenseObject) {
|
|
12
|
+
if (!license) return "";
|
|
13
|
+
const { name, url } = license;
|
|
14
|
+
|
|
15
|
+
return create("div", {
|
|
16
|
+
style: {
|
|
17
|
+
marginBottom: "var(--ifm-paragraph-margin-bottom)",
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
create("h3", {
|
|
21
|
+
style: {
|
|
22
|
+
marginBottom: "0.25rem",
|
|
23
|
+
},
|
|
24
|
+
children: "License",
|
|
25
|
+
}),
|
|
26
|
+
create("a", {
|
|
27
|
+
href: url,
|
|
28
|
+
children: name,
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { create } from "./utils";
|
|
9
|
+
|
|
10
|
+
export function createTermsOfService(termsOfService: string | undefined) {
|
|
11
|
+
if (!createTermsOfService) return "";
|
|
12
|
+
|
|
13
|
+
return create("div", {
|
|
14
|
+
style: {
|
|
15
|
+
marginBottom: "var(--ifm-paragraph-margin-bottom)",
|
|
16
|
+
},
|
|
17
|
+
children: [
|
|
18
|
+
create("h3", {
|
|
19
|
+
style: {
|
|
20
|
+
marginBottom: "0.25rem",
|
|
21
|
+
},
|
|
22
|
+
children: "Terms of Service",
|
|
23
|
+
}),
|
|
24
|
+
create("a", {
|
|
25
|
+
href: `${termsOfService}`,
|
|
26
|
+
children: termsOfService,
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
}
|