docusaurus-plugin-openapi-docs 4.5.1 → 4.7.0
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/README.md +110 -22
- package/lib/index.js +122 -50
- package/lib/markdown/createHeading.js +1 -1
- package/lib/markdown/createRequestHeader.js +5 -3
- package/lib/markdown/createSchema.js +2 -2
- package/lib/markdown/index.js +3 -2
- package/lib/markdown/schema.js +5 -0
- package/lib/markdown/utils.d.ts +38 -1
- package/lib/markdown/utils.js +100 -2
- package/lib/openapi/createSchemaExample.js +16 -2
- package/lib/openapi/createSchemaExample.test.d.ts +1 -0
- package/lib/openapi/createSchemaExample.test.js +48 -0
- package/lib/openapi/openapi.js +38 -17
- package/lib/openapi/openapi.test.js +48 -0
- package/lib/openapi/webhooks.test.d.ts +1 -0
- package/lib/openapi/webhooks.test.js +23 -0
- package/lib/options.js +4 -0
- package/lib/sidebars/index.js +12 -3
- package/package.json +16 -16
- package/src/index.ts +165 -62
- package/src/markdown/createHeading.ts +2 -2
- package/src/markdown/createRequestHeader.ts +9 -11
- package/src/markdown/createSchema.ts +4 -2
- package/src/markdown/index.ts +3 -2
- package/src/markdown/schema.ts +6 -0
- package/src/markdown/utils.ts +153 -3
- package/src/openapi/__fixtures__/webhook/openapi.yaml +17 -0
- package/src/openapi/createSchemaExample.test.ts +57 -0
- package/src/openapi/createSchemaExample.ts +26 -2
- package/src/openapi/openapi.test.ts +58 -0
- package/src/openapi/openapi.ts +35 -6
- package/src/openapi/webhooks.test.ts +30 -0
- package/src/options.ts +4 -0
- package/src/plugin-openapi.d.ts +1 -1
- package/src/sidebars/index.ts +15 -3
- package/src/{types.ts → types.d.ts} +12 -2
- package/lib/types.d.ts +0 -135
- package/lib/types.js +0 -8
- package/src/plugin-content-docs-types.d.ts +0 -42
package/lib/types.d.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { SidebarItemDoc } from "@docusaurus/plugin-content-docs/src/sidebars/types";
|
|
2
|
-
import { InfoObject, OperationObject, SchemaObject, SecuritySchemeObject, TagObject } from "./openapi/types";
|
|
3
|
-
export type { PropSidebarItemCategory, SidebarItemLink, PropSidebar, PropSidebarItem, } from "@docusaurus/plugin-content-docs-types";
|
|
4
|
-
export interface PluginOptions {
|
|
5
|
-
id?: string;
|
|
6
|
-
docsPlugin?: string;
|
|
7
|
-
docsPluginId: string;
|
|
8
|
-
config: {
|
|
9
|
-
[key: string]: APIOptions;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export interface APIOptions {
|
|
13
|
-
specPath: string;
|
|
14
|
-
outputDir: string;
|
|
15
|
-
template?: string;
|
|
16
|
-
infoTemplate?: string;
|
|
17
|
-
tagTemplate?: string;
|
|
18
|
-
schemaTemplate?: string;
|
|
19
|
-
downloadUrl?: string;
|
|
20
|
-
hideSendButton?: boolean;
|
|
21
|
-
showExtensions?: boolean;
|
|
22
|
-
sidebarOptions?: SidebarOptions;
|
|
23
|
-
version?: string;
|
|
24
|
-
label?: string;
|
|
25
|
-
baseUrl?: string;
|
|
26
|
-
versions?: {
|
|
27
|
-
[key: string]: APIVersionOptions;
|
|
28
|
-
};
|
|
29
|
-
proxy?: string;
|
|
30
|
-
markdownGenerators?: MarkdownGenerator;
|
|
31
|
-
showSchemas?: boolean;
|
|
32
|
-
disableCompression?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export interface MarkdownGenerator {
|
|
35
|
-
createApiPageMD?: (pageData: ApiPageMetadata) => string;
|
|
36
|
-
createInfoPageMD?: (pageData: InfoPageMetadata) => string;
|
|
37
|
-
createTagPageMD?: (pageData: TagPageMetadata) => string;
|
|
38
|
-
createSchemaPageMD?: (pageData: SchemaPageMetadata) => string;
|
|
39
|
-
}
|
|
40
|
-
export type ApiDocItemGenerator = (item: ApiPageMetadata | SchemaPageMetadata, context: {
|
|
41
|
-
sidebarOptions: SidebarOptions;
|
|
42
|
-
basePath: string;
|
|
43
|
-
}) => SidebarItemDoc;
|
|
44
|
-
export interface SidebarGenerators {
|
|
45
|
-
createDocItem?: ApiDocItemGenerator;
|
|
46
|
-
}
|
|
47
|
-
export interface SidebarOptions {
|
|
48
|
-
groupPathsBy?: string;
|
|
49
|
-
categoryLinkSource?: "info" | "tag" | "auto";
|
|
50
|
-
customProps?: {
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
};
|
|
53
|
-
sidebarCollapsible?: boolean;
|
|
54
|
-
sidebarCollapsed?: boolean;
|
|
55
|
-
sidebarGenerators?: SidebarGenerators;
|
|
56
|
-
}
|
|
57
|
-
export interface APIVersionOptions {
|
|
58
|
-
specPath: string;
|
|
59
|
-
outputDir: string;
|
|
60
|
-
label: string;
|
|
61
|
-
baseUrl: string;
|
|
62
|
-
downloadUrl?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface LoadedContent {
|
|
65
|
-
loadedApi: ApiMetadata[];
|
|
66
|
-
}
|
|
67
|
-
export type ApiMetadata = ApiPageMetadata | InfoPageMetadata | TagPageMetadata | SchemaPageMetadata;
|
|
68
|
-
export interface ApiMetadataBase {
|
|
69
|
-
sidebar?: string;
|
|
70
|
-
previous?: ApiNavLink;
|
|
71
|
-
next?: ApiNavLink;
|
|
72
|
-
id: string;
|
|
73
|
-
unversionedId: string;
|
|
74
|
-
infoId?: string;
|
|
75
|
-
infoPath?: string;
|
|
76
|
-
downloadUrl?: string;
|
|
77
|
-
title: string;
|
|
78
|
-
description: string;
|
|
79
|
-
source: string;
|
|
80
|
-
sourceDirName: string;
|
|
81
|
-
slug?: string;
|
|
82
|
-
permalink: string;
|
|
83
|
-
sidebarPosition?: number;
|
|
84
|
-
frontMatter: Record<string, unknown>;
|
|
85
|
-
method?: string;
|
|
86
|
-
path?: string;
|
|
87
|
-
position?: number;
|
|
88
|
-
}
|
|
89
|
-
export interface ApiPageMetadata extends ApiMetadataBase {
|
|
90
|
-
json?: string;
|
|
91
|
-
type: "api";
|
|
92
|
-
api: ApiItem;
|
|
93
|
-
markdown?: string;
|
|
94
|
-
}
|
|
95
|
-
export interface ApiItem extends OperationObject {
|
|
96
|
-
method: string;
|
|
97
|
-
path: string;
|
|
98
|
-
jsonRequestBodyExample: string;
|
|
99
|
-
securitySchemes?: {
|
|
100
|
-
[key: string]: SecuritySchemeObject;
|
|
101
|
-
};
|
|
102
|
-
postman?: Request;
|
|
103
|
-
proxy?: string;
|
|
104
|
-
info: InfoObject;
|
|
105
|
-
extensions?: object;
|
|
106
|
-
}
|
|
107
|
-
export interface InfoPageMetadata extends ApiMetadataBase {
|
|
108
|
-
type: "info";
|
|
109
|
-
info: ApiInfo;
|
|
110
|
-
markdown?: string;
|
|
111
|
-
securitySchemes?: {
|
|
112
|
-
[key: string]: SecuritySchemeObject;
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
export interface TagPageMetadata extends ApiMetadataBase {
|
|
116
|
-
type: "tag";
|
|
117
|
-
tag: TagObject;
|
|
118
|
-
markdown?: string;
|
|
119
|
-
}
|
|
120
|
-
export interface SchemaPageMetadata extends ApiMetadataBase {
|
|
121
|
-
type: "schema";
|
|
122
|
-
schema: SchemaObject;
|
|
123
|
-
markdown?: string;
|
|
124
|
-
}
|
|
125
|
-
export interface TagGroupPageMetadata extends ApiMetadataBase {
|
|
126
|
-
type: "tagGroup";
|
|
127
|
-
name: string;
|
|
128
|
-
tags: TagObject[];
|
|
129
|
-
markdown?: string;
|
|
130
|
-
}
|
|
131
|
-
export type ApiInfo = InfoObject;
|
|
132
|
-
export interface ApiNavLink {
|
|
133
|
-
title: string;
|
|
134
|
-
permalink: string;
|
|
135
|
-
}
|
package/lib/types.js
DELETED
|
@@ -1,8 +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 });
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
declare module "@docusaurus/plugin-content-docs-types" {
|
|
9
|
-
// Makes all properties visible when hovering over the type
|
|
10
|
-
type Expand<T extends Record<string, unknown>> = { [P in keyof T]: T[P] };
|
|
11
|
-
|
|
12
|
-
export type SidebarItemBase = {
|
|
13
|
-
className?: string;
|
|
14
|
-
customProps?: Record<string, unknown>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type SidebarItemLink = SidebarItemBase & {
|
|
18
|
-
type: "link";
|
|
19
|
-
href: string;
|
|
20
|
-
label: string;
|
|
21
|
-
docId: string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
type SidebarItemCategoryBase = SidebarItemBase & {
|
|
25
|
-
type: "category";
|
|
26
|
-
label: string;
|
|
27
|
-
collapsed: boolean;
|
|
28
|
-
collapsible: boolean;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type PropSidebarItemCategory = Expand<
|
|
32
|
-
SidebarItemCategoryBase & {
|
|
33
|
-
items: PropSidebarItem[];
|
|
34
|
-
}
|
|
35
|
-
>;
|
|
36
|
-
|
|
37
|
-
export type PropSidebarItem = SidebarItemLink | PropSidebarItemCategory;
|
|
38
|
-
export type PropSidebar = PropSidebarItem[];
|
|
39
|
-
export type PropSidebars = {
|
|
40
|
-
[sidebarId: string]: PropSidebar;
|
|
41
|
-
};
|
|
42
|
-
}
|