docusaurus-plugin-openapi-docs 1.0.0 → 1.0.3

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.
Files changed (58) hide show
  1. package/README.md +8 -7
  2. package/lib/index.d.ts +1 -0
  3. package/lib/index.js +80 -9
  4. package/lib/markdown/createAuthentication.d.ts +2 -0
  5. package/lib/markdown/createAuthentication.js +139 -0
  6. package/lib/markdown/createContactInfo.d.ts +2 -0
  7. package/lib/markdown/createContactInfo.js +49 -0
  8. package/lib/markdown/createLicense.d.ts +2 -0
  9. package/lib/markdown/createLicense.js +33 -0
  10. package/lib/markdown/createSchemaDetails.js +4 -1
  11. package/lib/markdown/createStatusCodes.js +1 -1
  12. package/lib/markdown/createTermsOfService.d.ts +1 -0
  13. package/lib/markdown/createTermsOfService.js +32 -0
  14. package/lib/markdown/index.d.ts +3 -2
  15. package/lib/markdown/index.js +17 -3
  16. package/lib/openapi/createExample.js +59 -49
  17. package/lib/openapi/openapi.d.ts +5 -4
  18. package/lib/openapi/openapi.js +94 -50
  19. package/lib/openapi/openapi.test.js +0 -6
  20. package/lib/openapi/types.d.ts +5 -1
  21. package/lib/openapi/utils/loadAndBundleSpec.d.ts +3 -0
  22. package/lib/openapi/utils/loadAndBundleSpec.js +44 -0
  23. package/lib/openapi/utils/types.d.ts +306 -0
  24. package/lib/{markdown/createRequestBodyTable.js → openapi/utils/types.js} +0 -6
  25. package/lib/sidebars/index.d.ts +2 -1
  26. package/lib/sidebars/index.js +87 -30
  27. package/lib/types.d.ts +14 -3
  28. package/package.json +19 -11
  29. package/src/index.ts +108 -11
  30. package/src/markdown/createAuthentication.ts +160 -0
  31. package/src/markdown/createContactInfo.ts +52 -0
  32. package/src/markdown/createLicense.ts +34 -0
  33. package/src/markdown/createSchemaDetails.ts +6 -2
  34. package/src/markdown/createStatusCodes.ts +1 -1
  35. package/src/markdown/createTermsOfService.ts +30 -0
  36. package/src/markdown/index.ts +23 -3
  37. package/src/openapi/createExample.ts +59 -50
  38. package/src/openapi/openapi.test.ts +0 -6
  39. package/src/openapi/openapi.ts +115 -53
  40. package/src/openapi/types.ts +5 -1
  41. package/src/openapi/utils/loadAndBundleSpec.ts +62 -0
  42. package/src/openapi/utils/types.ts +303 -0
  43. package/src/{markdown/createRequestBodyTable.ts → postman-collection.d.ts} +2 -9
  44. package/src/sidebars/index.ts +108 -31
  45. package/src/types.ts +15 -3
  46. package/lib/markdown/createFullWidthTable.d.ts +0 -2
  47. package/lib/markdown/createFullWidthTable.js +0 -18
  48. package/lib/markdown/createParamsTable.d.ts +0 -7
  49. package/lib/markdown/createParamsTable.js +0 -80
  50. package/lib/markdown/createRequestBodyTable.d.ts +0 -6
  51. package/lib/markdown/createSchemaTable.d.ts +0 -14
  52. package/lib/markdown/createSchemaTable.js +0 -217
  53. package/src/markdown/createFullWidthTable.ts +0 -16
  54. package/src/markdown/createParamsTable.ts +0 -102
  55. package/src/markdown/createSchemaTable.ts +0 -275
  56. package/src/openapi/__fixtures__/examples/yogurtstore/_category_.json +0 -4
  57. package/src/openapi/__fixtures__/examples/yogurtstore/froyo.yaml +0 -13
  58. package/src/openapi/__fixtures__/examples/yogurtstore/nested/nested.yaml +0 -13
@@ -0,0 +1,303 @@
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
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
9
+
10
+ export interface OpenAPISpec {
11
+ openapi: string;
12
+ info: OpenAPIInfo;
13
+ servers?: OpenAPIServer[];
14
+ paths: OpenAPIPaths;
15
+ components?: OpenAPIComponents;
16
+ security?: OpenAPISecurityRequirement[];
17
+ tags?: OpenAPITag[];
18
+ externalDocs?: OpenAPIExternalDocumentation;
19
+ "x-webhooks"?: OpenAPIPaths;
20
+ webhooks?: OpenAPIPaths;
21
+ }
22
+
23
+ export interface OpenAPIInfo {
24
+ title: string;
25
+ version: string;
26
+
27
+ description?: string;
28
+ summary?: string;
29
+ termsOfService?: string;
30
+ contact?: OpenAPIContact;
31
+ license?: OpenAPILicense;
32
+ }
33
+
34
+ export interface OpenAPIServer {
35
+ url: string;
36
+ description?: string;
37
+ variables?: { [name: string]: OpenAPIServerVariable };
38
+ }
39
+
40
+ export interface OpenAPIServerVariable {
41
+ enum?: string[];
42
+ default: string;
43
+ description?: string;
44
+ }
45
+
46
+ export interface OpenAPIPaths {
47
+ [path: string]: OpenAPIPath;
48
+ }
49
+ export interface OpenAPIRef {
50
+ $ref: string;
51
+ }
52
+
53
+ export type Referenced<T> = OpenAPIRef | T;
54
+
55
+ export interface OpenAPIPath {
56
+ summary?: string;
57
+ description?: string;
58
+ get?: OpenAPIOperation;
59
+ put?: OpenAPIOperation;
60
+ post?: OpenAPIOperation;
61
+ delete?: OpenAPIOperation;
62
+ options?: OpenAPIOperation;
63
+ head?: OpenAPIOperation;
64
+ patch?: OpenAPIOperation;
65
+ trace?: OpenAPIOperation;
66
+ servers?: OpenAPIServer[];
67
+ parameters?: Array<Referenced<OpenAPIParameter>>;
68
+ $ref?: string;
69
+ }
70
+
71
+ export interface OpenAPIXCodeSample {
72
+ lang: string;
73
+ label?: string;
74
+ source: string;
75
+ }
76
+
77
+ export interface OpenAPIOperation {
78
+ tags?: string[];
79
+ summary?: string;
80
+ description?: string;
81
+ externalDocs?: OpenAPIExternalDocumentation;
82
+ operationId?: string;
83
+ parameters?: Array<Referenced<OpenAPIParameter>>;
84
+ requestBody?: Referenced<OpenAPIRequestBody>;
85
+ responses: OpenAPIResponses;
86
+ callbacks?: { [name: string]: Referenced<OpenAPICallback> };
87
+ deprecated?: boolean;
88
+ security?: OpenAPISecurityRequirement[];
89
+ servers?: OpenAPIServer[];
90
+ "x-codeSamples"?: OpenAPIXCodeSample[];
91
+ "x-code-samples"?: OpenAPIXCodeSample[]; // deprecated
92
+ }
93
+
94
+ export interface OpenAPIParameter {
95
+ name: string;
96
+ in?: OpenAPIParameterLocation;
97
+ description?: string;
98
+ required?: boolean;
99
+ deprecated?: boolean;
100
+ allowEmptyValue?: boolean;
101
+ style?: OpenAPIParameterStyle;
102
+ explode?: boolean;
103
+ allowReserved?: boolean;
104
+ schema?: Referenced<OpenAPISchema>;
105
+ example?: any;
106
+ examples?: { [media: string]: Referenced<OpenAPIExample> };
107
+ content?: { [media: string]: OpenAPIMediaType };
108
+ encoding?: Record<string, OpenAPIEncoding>;
109
+ const?: any;
110
+ }
111
+
112
+ export interface OpenAPIExample {
113
+ value: any;
114
+ summary?: string;
115
+ description?: string;
116
+ externalValue?: string;
117
+ }
118
+
119
+ export interface OpenAPISchema {
120
+ $ref?: string;
121
+ type?: string | string[];
122
+ properties?: { [name: string]: OpenAPISchema };
123
+ patternProperties?: { [name: string]: OpenAPISchema };
124
+ additionalProperties?: boolean | OpenAPISchema;
125
+ unevaluatedProperties?: boolean | OpenAPISchema;
126
+ description?: string;
127
+ default?: any;
128
+ items?: OpenAPISchema | OpenAPISchema[] | boolean;
129
+ required?: string[];
130
+ readOnly?: boolean;
131
+ writeOnly?: boolean;
132
+ deprecated?: boolean;
133
+ format?: string;
134
+ externalDocs?: OpenAPIExternalDocumentation;
135
+ discriminator?: OpenAPIDiscriminator;
136
+ nullable?: boolean;
137
+ oneOf?: OpenAPISchema[];
138
+ anyOf?: OpenAPISchema[];
139
+ allOf?: OpenAPISchema[];
140
+ not?: OpenAPISchema;
141
+
142
+ title?: string;
143
+ multipleOf?: number;
144
+ maximum?: number;
145
+ exclusiveMaximum?: boolean | number;
146
+ minimum?: number;
147
+ exclusiveMinimum?: boolean | number;
148
+ maxLength?: number;
149
+ minLength?: number;
150
+ pattern?: string;
151
+ maxItems?: number;
152
+ minItems?: number;
153
+ uniqueItems?: boolean;
154
+ maxProperties?: number;
155
+ minProperties?: number;
156
+ enum?: any[];
157
+ example?: any;
158
+
159
+ if?: OpenAPISchema;
160
+ else?: OpenAPISchema;
161
+ then?: OpenAPISchema;
162
+ examples?: any[];
163
+ const?: string;
164
+ contentEncoding?: string;
165
+ contentMediaType?: string;
166
+ prefixItems?: OpenAPISchema[];
167
+ additionalItems?: OpenAPISchema | boolean;
168
+ }
169
+
170
+ export interface OpenAPIDiscriminator {
171
+ propertyName: string;
172
+ mapping?: { [name: string]: string };
173
+ "x-explicitMappingOnly"?: boolean;
174
+ }
175
+
176
+ export interface OpenAPIMediaType {
177
+ schema?: Referenced<OpenAPISchema>;
178
+ example?: any;
179
+ examples?: { [name: string]: Referenced<OpenAPIExample> };
180
+ encoding?: { [field: string]: OpenAPIEncoding };
181
+ }
182
+
183
+ export interface OpenAPIEncoding {
184
+ contentType: string;
185
+ headers?: { [name: string]: Referenced<OpenAPIHeader> };
186
+ style: OpenAPIParameterStyle;
187
+ explode: boolean;
188
+ allowReserved: boolean;
189
+ }
190
+
191
+ export type OpenAPIParameterLocation = "query" | "header" | "path" | "cookie";
192
+ export type OpenAPIParameterStyle =
193
+ | "matrix"
194
+ | "label"
195
+ | "form"
196
+ | "simple"
197
+ | "spaceDelimited"
198
+ | "pipeDelimited"
199
+ | "deepObject";
200
+
201
+ export interface OpenAPIRequestBody {
202
+ description?: string;
203
+ required?: boolean;
204
+ content: { [mime: string]: OpenAPIMediaType };
205
+
206
+ "x-examples"?: {
207
+ [mime: string]: { [name: string]: Referenced<OpenAPIExample> };
208
+ };
209
+ "x-example"?: { [mime: string]: any };
210
+ }
211
+
212
+ export interface OpenAPIResponses {
213
+ [code: string]: Referenced<OpenAPIResponse>;
214
+ }
215
+
216
+ export interface OpenAPIResponse
217
+ extends Pick<OpenAPIRequestBody, "description" | "x-examples" | "x-example"> {
218
+ headers?: { [name: string]: Referenced<OpenAPIHeader> };
219
+ links?: { [name: string]: Referenced<OpenAPILink> };
220
+ content?: { [mime: string]: OpenAPIMediaType };
221
+ }
222
+
223
+ export interface OpenAPILink {
224
+ $ref?: string;
225
+ }
226
+
227
+ export type OpenAPIHeader = Omit<OpenAPIParameter, "in" | "name">;
228
+
229
+ export interface OpenAPICallback {
230
+ [name: string]: OpenAPIPath;
231
+ }
232
+
233
+ export interface OpenAPIComponents {
234
+ schemas?: { [name: string]: Referenced<OpenAPISchema> };
235
+ responses?: { [name: string]: Referenced<OpenAPIResponse> };
236
+ parameters?: { [name: string]: Referenced<OpenAPIParameter> };
237
+ examples?: { [name: string]: Referenced<OpenAPIExample> };
238
+ requestBodies?: { [name: string]: Referenced<OpenAPIRequestBody> };
239
+ headers?: { [name: string]: Referenced<OpenAPIHeader> };
240
+ securitySchemes?: { [name: string]: Referenced<OpenAPISecurityScheme> };
241
+ links?: { [name: string]: Referenced<OpenAPILink> };
242
+ callbacks?: { [name: string]: Referenced<OpenAPICallback> };
243
+ }
244
+
245
+ export interface OpenAPISecurityRequirement {
246
+ [name: string]: string[];
247
+ }
248
+
249
+ export interface OpenAPISecurityScheme {
250
+ type: "apiKey" | "http" | "oauth2" | "openIdConnect";
251
+ description?: string;
252
+ name?: string;
253
+ in?: "query" | "header" | "cookie";
254
+ scheme?: string;
255
+ bearerFormat: string;
256
+ flows: {
257
+ implicit?: {
258
+ refreshUrl?: string;
259
+ scopes: Record<string, string>;
260
+ authorizationUrl: string;
261
+ };
262
+ password?: {
263
+ refreshUrl?: string;
264
+ scopes: Record<string, string>;
265
+ tokenUrl: string;
266
+ };
267
+ clientCredentials?: {
268
+ refreshUrl?: string;
269
+ scopes: Record<string, string>;
270
+ tokenUrl: string;
271
+ };
272
+ authorizationCode?: {
273
+ refreshUrl?: string;
274
+ scopes: Record<string, string>;
275
+ tokenUrl: string;
276
+ };
277
+ };
278
+ openIdConnectUrl?: string;
279
+ }
280
+
281
+ export interface OpenAPITag {
282
+ name: string;
283
+ description?: string;
284
+ externalDocs?: OpenAPIExternalDocumentation;
285
+ "x-displayName"?: string;
286
+ }
287
+
288
+ export interface OpenAPIExternalDocumentation {
289
+ description?: string;
290
+ url: string;
291
+ }
292
+
293
+ export interface OpenAPIContact {
294
+ name?: string;
295
+ url?: string;
296
+ email?: string;
297
+ }
298
+
299
+ export interface OpenAPILicense {
300
+ name: string;
301
+ url?: string;
302
+ identifier?: string;
303
+ }
@@ -5,13 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
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 });
8
+ declare module "@paloaltonetworks/postman-collection" {
9
+ export default any;
17
10
  }
@@ -7,11 +7,15 @@
7
7
 
8
8
  import {
9
9
  ProcessedSidebar,
10
+ SidebarItemCategory,
11
+ SidebarItemCategoryLinkConfig,
10
12
  SidebarItemDoc,
11
13
  } from "@docusaurus/plugin-content-docs/src/sidebars/types";
12
14
  import clsx from "clsx";
15
+ import { kebabCase } from "lodash";
13
16
  import uniq from "lodash/uniq";
14
17
 
18
+ import { TagObject } from "../openapi/types";
15
19
  import type {
16
20
  SidebarOptions,
17
21
  APIOptions,
@@ -23,28 +27,37 @@ function isApiItem(item: ApiMetadata): item is ApiMetadata {
23
27
  return item.type === "api";
24
28
  }
25
29
 
30
+ function isInfoItem(item: ApiMetadata): item is ApiMetadata {
31
+ return item.type === "info";
32
+ }
33
+
26
34
  function groupByTags(
27
35
  items: ApiPageMetadata[],
28
36
  sidebarOptions: SidebarOptions,
29
- options: APIOptions
37
+ options: APIOptions,
38
+ tags: TagObject[]
30
39
  ): ProcessedSidebar {
31
- // TODO: Figure out how to handle these
32
- // const intros = items.filter(isInfoItem).map((item) => {
33
- // return {
34
- // type: "link" as const,
35
- // label: item.title,
36
- // href: item.permalink,
37
- // docId: item.id,
38
- // };
39
- // });
40
-
41
40
  const { outputDir } = options;
42
- const { sidebarCollapsed, sidebarCollapsible, customProps } = sidebarOptions;
41
+ const {
42
+ sidebarCollapsed,
43
+ sidebarCollapsible,
44
+ customProps,
45
+ categoryLinkSource,
46
+ } = sidebarOptions;
43
47
 
44
48
  const apiItems = items.filter(isApiItem);
49
+ const infoItems = items.filter(isInfoItem);
50
+ const intros = infoItems.map((item: any) => {
51
+ return {
52
+ id: item.id,
53
+ title: item.title,
54
+ description: item.description,
55
+ tags: item.info.tags,
56
+ };
57
+ });
45
58
 
46
59
  // TODO: make sure we only take the first tag
47
- const tags = uniq(
60
+ const apiTags = uniq(
48
61
  apiItems
49
62
  .flatMap((item) => item.api.tags)
50
63
  .filter((item): item is string => !!item)
@@ -74,11 +87,61 @@ function groupByTags(
74
87
  };
75
88
  }
76
89
 
77
- const tagged = tags
90
+ let rootIntroDoc = undefined;
91
+ if (infoItems.length === 1) {
92
+ const infoItem = infoItems[0];
93
+ const id = infoItem.id;
94
+ rootIntroDoc = {
95
+ type: "doc" as const,
96
+ id: `${basePath}/${id}`,
97
+ };
98
+ }
99
+
100
+ const tagged = apiTags
78
101
  .map((tag) => {
102
+ // Map info object to tag
103
+ const taggedInfoObject = intros.find((i) =>
104
+ i.tags ? i.tags.includes(tag) : undefined
105
+ );
106
+ const tagObject = tags.flat().find(
107
+ (t) =>
108
+ (tag === t.name || tag === t["x-displayName"]) ?? {
109
+ name: tag,
110
+ description: `${tag} Index`,
111
+ }
112
+ );
113
+
114
+ // TODO: perhaps move this into a getLinkConfig() function
115
+ let linkConfig = undefined;
116
+ if (taggedInfoObject !== undefined && categoryLinkSource === "info") {
117
+ linkConfig = {
118
+ type: "doc",
119
+ id: `${basePath}/${taggedInfoObject.id}`,
120
+ } as SidebarItemCategoryLinkConfig;
121
+ }
122
+
123
+ // TODO: perhaps move this into a getLinkConfig() function
124
+ if (tagObject !== undefined && categoryLinkSource === "tag") {
125
+ const tagId = kebabCase(tagObject.name);
126
+ linkConfig = {
127
+ type: "doc",
128
+ id: `${basePath}/${tagId}`,
129
+ } as SidebarItemCategoryLinkConfig;
130
+ }
131
+
132
+ // Default behavior
133
+ if (categoryLinkSource === undefined) {
134
+ linkConfig = {
135
+ type: "generated-index" as "generated-index",
136
+ title: tag,
137
+ slug: "/category/" + kebabCase(tag),
138
+ } as SidebarItemCategoryLinkConfig;
139
+ }
140
+
79
141
  return {
80
142
  type: "category" as const,
81
143
  label: tag,
144
+ link: linkConfig,
82
145
  collapsible: sidebarCollapsible,
83
146
  collapsed: sidebarCollapsed,
84
147
  items: apiItems
@@ -88,33 +151,47 @@ function groupByTags(
88
151
  })
89
152
  .filter((item) => item.items.length > 0); // Filter out any categories with no items.
90
153
 
91
- // const untagged = [
92
- // // TODO: determine if needed and how
93
- // {
94
- // type: "category" as const,
95
- // label: "UNTAGGED",
96
- // // collapsible: options.sidebarCollapsible, TODO: add option
97
- // // collapsed: options.sidebarCollapsed, TODO: add option
98
- // items: apiItems
99
- // //@ts-ignore
100
- // .filter(({ api }) => api.tags === undefined || api.tags.length === 0)
101
- // .map(createDocItem),
102
- // },
103
- // ];
104
- return [...tagged];
154
+ // Handle items with no tag
155
+ const untaggedItems = apiItems
156
+ .filter(({ api }) => api.tags === undefined || api.tags.length === 0)
157
+ .map(createDocItem);
158
+ let untagged: SidebarItemCategory[] = [];
159
+ if (untaggedItems.length > 0) {
160
+ untagged = [
161
+ {
162
+ type: "category" as const,
163
+ label: "UNTAGGED",
164
+ collapsible: sidebarCollapsible!,
165
+ collapsed: sidebarCollapsed!,
166
+ items: apiItems
167
+ .filter(({ api }) => api.tags === undefined || api.tags.length === 0)
168
+ .map(createDocItem),
169
+ },
170
+ ];
171
+ }
172
+
173
+ // Shift root intro doc to top of sidebar
174
+ // TODO: Add input validation for categoryLinkSource options
175
+ if (rootIntroDoc && categoryLinkSource !== "info") {
176
+ tagged.unshift(rootIntroDoc as any);
177
+ }
178
+
179
+ return [...tagged, ...untagged];
105
180
  }
106
181
 
107
182
  export default function generateSidebarSlice(
108
183
  sidebarOptions: SidebarOptions,
109
184
  options: APIOptions,
110
- api: ApiMetadata[]
185
+ api: ApiMetadata[],
186
+ tags: TagObject[]
111
187
  ) {
112
188
  let sidebarSlice: ProcessedSidebar = [];
113
- if (sidebarOptions.groupPathsBy === "tags") {
189
+ if (sidebarOptions.groupPathsBy === "tag") {
114
190
  sidebarSlice = groupByTags(
115
191
  api as ApiPageMetadata[],
116
192
  sidebarOptions,
117
- options
193
+ options,
194
+ tags
118
195
  );
119
196
  }
120
197
  return sidebarSlice;
package/src/types.ts CHANGED
@@ -5,13 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- // @ts-ignore
9
- import type { Request } from "@paloaltonetworks/postman-collection";
8
+ import type Request from "@paloaltonetworks/postman-collection";
10
9
 
11
10
  import {
12
11
  InfoObject,
13
12
  OperationObject,
14
13
  SecuritySchemeObject,
14
+ TagObject,
15
15
  } from "./openapi/types";
16
16
 
17
17
  export type {
@@ -39,7 +39,7 @@ export interface LoadedContent {
39
39
  // loadedDocs: DocPageMetadata[]; TODO: cleanup
40
40
  }
41
41
 
42
- export type ApiMetadata = ApiPageMetadata | InfoPageMetadata;
42
+ export type ApiMetadata = ApiPageMetadata | InfoPageMetadata | TagPageMetadata;
43
43
 
44
44
  export interface ApiMetadataBase {
45
45
  sidebar?: string;
@@ -48,6 +48,8 @@ export interface ApiMetadataBase {
48
48
  //
49
49
  id: string; // TODO legacy versioned id => try to remove
50
50
  unversionedId: string; // TODO new unversioned id => try to rename to "id"
51
+ infoId?: string;
52
+ infoPath?: string;
51
53
  title: string;
52
54
  description: string;
53
55
  source: string; // @site aliased source => "@site/docs/folder/subFolder/subSubFolder/myDoc.md"
@@ -80,6 +82,15 @@ export interface InfoPageMetadata extends ApiMetadataBase {
80
82
  type: "info";
81
83
  info: ApiInfo;
82
84
  markdown?: string;
85
+ securitySchemes?: {
86
+ [key: string]: SecuritySchemeObject;
87
+ };
88
+ }
89
+
90
+ export interface TagPageMetadata extends ApiMetadataBase {
91
+ type: "tag";
92
+ tag: TagObject;
93
+ markdown?: string;
83
94
  }
84
95
 
85
96
  export type ApiInfo = InfoObject;
@@ -91,6 +102,7 @@ export interface ApiNavLink {
91
102
 
92
103
  export interface SidebarOptions {
93
104
  groupPathsBy?: string;
105
+ categoryLinkSource?: string;
94
106
  customProps?: { [key: string]: unknown };
95
107
  sidebarCollapsible?: boolean;
96
108
  sidebarCollapsed?: boolean;
@@ -1,2 +0,0 @@
1
- import { Props } from "./utils";
2
- export declare function createFullWidthTable({ children, style, ...rest }: Props): string;
@@ -1,18 +0,0 @@
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.createFullWidthTable = void 0;
10
- const utils_1 = require("./utils");
11
- function createFullWidthTable({ children, style, ...rest }) {
12
- return (0, utils_1.create)("table", {
13
- style: { display: "table", width: "100%", ...style },
14
- ...rest,
15
- children,
16
- });
17
- }
18
- exports.createFullWidthTable = createFullWidthTable;
@@ -1,7 +0,0 @@
1
- import { ApiItem } from "../types";
2
- interface Props {
3
- parameters: ApiItem["parameters"];
4
- type: "path" | "query" | "header" | "cookie";
5
- }
6
- export declare function createParamsTable({ parameters, type }: Props): string | undefined;
7
- export {};
@@ -1,80 +0,0 @@
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.createParamsTable = void 0;
10
- const lodash_1 = require("lodash");
11
- const createDescription_1 = require("./createDescription");
12
- const createFullWidthTable_1 = require("./createFullWidthTable");
13
- const schema_1 = require("./schema");
14
- const utils_1 = require("./utils");
15
- function createParamsTable({ parameters, type }) {
16
- if (parameters === undefined) {
17
- return undefined;
18
- }
19
- const params = parameters.filter((param) => (param === null || param === void 0 ? void 0 : param.in) === type);
20
- if (params.length === 0) {
21
- return undefined;
22
- }
23
- return (0, createFullWidthTable_1.createFullWidthTable)({
24
- children: [
25
- (0, utils_1.create)("thead", {
26
- children: (0, utils_1.create)("tr", {
27
- children: (0, utils_1.create)("th", {
28
- style: { textAlign: "left" },
29
- children: `${type.charAt(0).toUpperCase() + type.slice(1)} Parameters`,
30
- }),
31
- }),
32
- }),
33
- (0, utils_1.create)("tbody", {
34
- children: params.map((param) => (0, utils_1.create)("tr", {
35
- children: (0, utils_1.create)("td", {
36
- children: [
37
- (0, utils_1.create)("code", { children: param.name }),
38
- (0, utils_1.guard)(param.schema, (schema) => (0, utils_1.create)("span", {
39
- style: { opacity: "0.6" },
40
- children: ` ${(0, schema_1.getSchemaName)(schema)}`,
41
- })),
42
- (0, utils_1.guard)(param.required, () => [
43
- (0, utils_1.create)("span", {
44
- style: { opacity: "0.6" },
45
- children: " — ",
46
- }),
47
- (0, utils_1.create)("strong", {
48
- style: {
49
- fontSize: "var(--ifm-code-font-size)",
50
- color: "var(--openapi-required)",
51
- },
52
- children: " REQUIRED",
53
- }),
54
- ]),
55
- (0, utils_1.guard)((0, schema_1.getQualifierMessage)(param.schema), (message) => (0, utils_1.create)("div", {
56
- style: { marginTop: "var(--ifm-table-cell-padding)" },
57
- children: (0, createDescription_1.createDescription)(message),
58
- })),
59
- (0, utils_1.guard)(param.description, (description) => (0, utils_1.create)("div", {
60
- style: { marginTop: "var(--ifm-table-cell-padding)" },
61
- children: (0, createDescription_1.createDescription)(description),
62
- })),
63
- (0, utils_1.guard)(param.example, (example) => (0, utils_1.create)("div", {
64
- style: { marginTop: "var(--ifm-table-cell-padding)" },
65
- children: (0, lodash_1.escape)(`Example: ${example}`),
66
- })),
67
- (0, utils_1.guard)(param.examples, (examples) => (0, utils_1.create)("div", {
68
- style: { marginTop: "var(--ifm-table-cell-padding)" },
69
- children: Object.entries(examples).map(([k, v]) => (0, utils_1.create)("div", {
70
- children: (0, lodash_1.escape)(`Example (${k}): ${v.value}`),
71
- })),
72
- })),
73
- ],
74
- }),
75
- })),
76
- }),
77
- ],
78
- });
79
- }
80
- exports.createParamsTable = createParamsTable;
@@ -1,6 +0,0 @@
1
- interface Props {
2
- title: string;
3
- body: any;
4
- }
5
- export declare function createRequestBodyTable({ title, body }: Props): string | undefined;
6
- export {};