docusaurus-plugin-openapi-docs 4.0.1 → 4.2.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 +11 -0
- package/lib/index.js +4 -0
- package/lib/markdown/createCallbackMethodEndpoint.d.ts +1 -0
- package/lib/markdown/createCallbackMethodEndpoint.js +21 -0
- package/lib/markdown/createCallbacks.js +2 -2
- package/lib/markdown/createContactInfo.js +1 -1
- package/lib/markdown/createDeprecationNotice.js +5 -6
- package/lib/markdown/createMethodEndpoint.js +8 -1
- package/lib/markdown/createParamsDetails.d.ts +1 -2
- package/lib/markdown/createParamsDetails.js +7 -36
- package/lib/markdown/createRequestBodyDetails.d.ts +1 -1
- package/lib/markdown/createRequestSchema.d.ts +1 -1
- package/lib/markdown/createRequestSchema.js +8 -132
- package/lib/markdown/createResponseSchema.d.ts +1 -1
- package/lib/markdown/createResponseSchema.js +8 -94
- package/lib/markdown/createSchema.d.ts +1 -4
- package/lib/markdown/createSchema.js +35 -50
- package/lib/markdown/createSchema.test.js +48 -0
- package/lib/markdown/createStatusCodes.d.ts +1 -4
- package/lib/markdown/createStatusCodes.js +10 -259
- package/lib/markdown/index.js +11 -22
- package/lib/markdown/utils.d.ts +4 -0
- package/lib/openapi/createRequestExample.js +2 -2
- package/lib/openapi/createResponseExample.js +2 -2
- package/lib/openapi/openapi.js +16 -14
- package/lib/openapi/types.d.ts +4 -0
- package/lib/openapi/utils/services/OpenAPIParser.js +1 -1
- package/lib/options.js +5 -0
- package/lib/sidebars/index.js +32 -26
- package/lib/types.d.ts +9 -0
- package/package.json +7 -7
- package/src/index.ts +4 -0
- package/src/markdown/__snapshots__/createSchema.test.ts.snap +142 -0
- package/src/markdown/createCallbackMethodEndpoint.ts +19 -0
- package/src/markdown/createCallbacks.ts +2 -2
- package/src/markdown/createContactInfo.ts +1 -1
- package/src/markdown/createDeprecationNotice.ts +3 -2
- package/src/markdown/createMethodEndpoint.ts +8 -1
- package/src/markdown/createParamsDetails.ts +7 -42
- package/src/markdown/createRequestSchema.ts +9 -143
- package/src/markdown/createResponseSchema.ts +9 -112
- package/src/markdown/createSchema.test.ts +64 -0
- package/src/markdown/createSchema.ts +30 -50
- package/src/markdown/createStatusCodes.ts +9 -268
- package/src/markdown/index.ts +11 -22
- package/src/markdown/utils.ts +4 -0
- package/src/openapi/createRequestExample.ts +2 -5
- package/src/openapi/createResponseExample.ts +2 -5
- package/src/openapi/openapi.ts +4 -2
- package/src/openapi/types.ts +4 -0
- package/src/openapi/utils/loadAndResolveSpec.ts +1 -1
- package/src/openapi/utils/services/OpenAPIParser.ts +1 -0
- package/src/options.ts +6 -0
- package/src/sidebars/index.ts +47 -40
- package/src/types.ts +11 -0
package/README.md
CHANGED
|
@@ -172,6 +172,8 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
|
|
|
172
172
|
| `markdownGenerators` | `object` | `null` | _Optional:_ Customize MDX content with a set of options for specifying markdown generator functions. See below for a list of supported options. |
|
|
173
173
|
| `showSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates schema pages and adds them to the sidebar. |
|
|
174
174
|
|
|
175
|
+
### sidebarOptions
|
|
176
|
+
|
|
175
177
|
`sidebarOptions` can be configured with the following options:
|
|
176
178
|
|
|
177
179
|
| Name | Type | Default | Description |
|
|
@@ -181,6 +183,7 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
|
|
|
181
183
|
| `sidebarCollapsible` | `boolean` | `true` | Whether sidebar categories are collapsible by default. |
|
|
182
184
|
| `sidebarCollapsed` | `boolean` | `true` | Whether sidebar categories are collapsed by default. |
|
|
183
185
|
| `customProps` | `object` | `null` | Additional props for customizing a sidebar item. |
|
|
186
|
+
| `sidebarGenerators` | `object` | `null` | Optional: Customize sidebar rendering with callback functions. |
|
|
184
187
|
|
|
185
188
|
> You may optionally configure a `sidebarOptions`. In doing so, an individual `sidebar.js` slice with the configured options will be generated within the respective `outputDir`.
|
|
186
189
|
|
|
@@ -206,6 +209,14 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
|
|
|
206
209
|
| `createTagPageMD` | `function` | `null` | _Optional:_ Returns a string of the raw markdown body for tag pages.<br/><br/>**Function type:** `(pageData: TagPageMetadata) => string` |
|
|
207
210
|
| `createSchemaPageMD` | `function` | `null` | _Optional:_ Returns a string of the raw markdown body for schema pages.<br/><br/>**Function type:** `(pageData: SchemaPageMetadata) => string` |
|
|
208
211
|
|
|
212
|
+
### sidebarGenerators
|
|
213
|
+
|
|
214
|
+
`sidebarGenerators` can be configured with the following options:
|
|
215
|
+
|
|
216
|
+
| Name | Type | Default | Description |
|
|
217
|
+
| --------------- | ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
218
|
+
| `createDocItem` | `function` | `null` | Optional: Returns a `SidebarItemDoc` object containing metadata for a sidebar item.<br/><br/>**Function type:** `(item: ApiPageMetadata \| SchemaPageMetadata, context: { sidebarOptions: SidebarOptions; basePath: string }) => SidebarItemDoc` |
|
|
219
|
+
|
|
209
220
|
## CLI Usage
|
|
210
221
|
|
|
211
222
|
```bash
|
package/lib/index.js
CHANGED
|
@@ -203,7 +203,11 @@ title: "{{{title}}}"
|
|
|
203
203
|
description: "{{{frontMatter.description}}}"
|
|
204
204
|
sidebar_label: "{{{title}}}"
|
|
205
205
|
hide_title: true
|
|
206
|
+
{{#schema}}
|
|
207
|
+
hide_table_of_contents: true
|
|
208
|
+
{{/schema}}
|
|
206
209
|
schema: true
|
|
210
|
+
sample: {{{frontMatter.sample}}}
|
|
207
211
|
custom_edit_url: null
|
|
208
212
|
---
|
|
209
213
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createCallbackMethodEndpoint(method: String, path: String): string[];
|
|
@@ -0,0 +1,21 @@
|
|
|
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.createCallbackMethodEndpoint = void 0;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function createCallbackMethodEndpoint(method, path) {
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("MethodEndpoint", {
|
|
14
|
+
method: method,
|
|
15
|
+
path: path,
|
|
16
|
+
context: "callback",
|
|
17
|
+
}),
|
|
18
|
+
"\n\n",
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
exports.createCallbackMethodEndpoint = createCallbackMethodEndpoint;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createCallbacks = void 0;
|
|
10
|
+
const createCallbackMethodEndpoint_1 = require("./createCallbackMethodEndpoint");
|
|
10
11
|
const createDescription_1 = require("./createDescription");
|
|
11
|
-
const createMethodEndpoint_1 = require("./createMethodEndpoint");
|
|
12
12
|
const createRequestBodyDetails_1 = require("./createRequestBodyDetails");
|
|
13
13
|
const createStatusCodes_1 = require("./createStatusCodes");
|
|
14
14
|
const utils_1 = require("./utils");
|
|
@@ -54,7 +54,7 @@ function createCallbacks({ callbacks }) {
|
|
|
54
54
|
label: `${method.toUpperCase()} ${name}`,
|
|
55
55
|
value: `${method}-${name}`,
|
|
56
56
|
children: [
|
|
57
|
-
(0,
|
|
57
|
+
(0, createCallbackMethodEndpoint_1.createCallbackMethodEndpoint)(method, path),
|
|
58
58
|
// TODO: add `deprecation notice` when markdown support is added
|
|
59
59
|
(0, createDescription_1.createDescription)(description),
|
|
60
60
|
(0, createRequestBodyDetails_1.createRequestBodyDetails)({
|
|
@@ -12,11 +12,10 @@ function createAdmonition({ children }) {
|
|
|
12
12
|
return `:::caution deprecated\n\n${(0, utils_1.render)(children)}\n\n:::`;
|
|
13
13
|
}
|
|
14
14
|
function createDeprecationNotice({ deprecated, description, }) {
|
|
15
|
-
return (0, utils_1.guard)(deprecated, () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
15
|
+
return (0, utils_1.guard)(deprecated, () => createAdmonition({
|
|
16
|
+
children: description && description.length > 0
|
|
17
|
+
? (0, utils_1.clean)(description)
|
|
18
|
+
: "This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
|
|
19
|
+
}));
|
|
21
20
|
}
|
|
22
21
|
exports.createDeprecationNotice = createDeprecationNotice;
|
|
@@ -9,6 +9,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.createMethodEndpoint = void 0;
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
function createMethodEndpoint(method, path) {
|
|
12
|
-
return [
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("MethodEndpoint", {
|
|
14
|
+
method: method,
|
|
15
|
+
path: path,
|
|
16
|
+
context: "endpoint",
|
|
17
|
+
}),
|
|
18
|
+
"\n\n",
|
|
19
|
+
];
|
|
13
20
|
}
|
|
14
21
|
exports.createMethodEndpoint = createMethodEndpoint;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ApiItem } from "../types";
|
|
2
2
|
interface Props {
|
|
3
3
|
parameters: ApiItem["parameters"];
|
|
4
|
-
type: "path" | "query" | "header" | "cookie";
|
|
5
4
|
}
|
|
6
|
-
export declare function createParamsDetails({ parameters
|
|
5
|
+
export declare function createParamsDetails({ parameters }: Props): string[];
|
|
7
6
|
export {};
|
|
@@ -7,42 +7,13 @@
|
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createParamsDetails = void 0;
|
|
10
|
-
const createDetails_1 = require("./createDetails");
|
|
11
|
-
const createDetailsSummary_1 = require("./createDetailsSummary");
|
|
12
10
|
const utils_1 = require("./utils");
|
|
13
|
-
function createParamsDetails({ parameters
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return (0, createDetails_1.createDetails)({
|
|
22
|
-
className: "openapi-markdown__details",
|
|
23
|
-
"data-collapsed": false,
|
|
24
|
-
open: true,
|
|
25
|
-
style: { marginBottom: "1rem" },
|
|
26
|
-
children: [
|
|
27
|
-
(0, createDetailsSummary_1.createDetailsSummary)({
|
|
28
|
-
children: [
|
|
29
|
-
(0, utils_1.create)("h3", {
|
|
30
|
-
className: "openapi-markdown__details-summary-header-params",
|
|
31
|
-
children: `${type.charAt(0).toUpperCase() + type.slice(1)} Parameters`,
|
|
32
|
-
}),
|
|
33
|
-
],
|
|
34
|
-
}),
|
|
35
|
-
(0, utils_1.create)("div", {
|
|
36
|
-
children: [
|
|
37
|
-
(0, utils_1.create)("ul", {
|
|
38
|
-
children: params.map((param) => (0, utils_1.create)("ParamsItem", {
|
|
39
|
-
className: "paramsItem",
|
|
40
|
-
param: param,
|
|
41
|
-
})),
|
|
42
|
-
}),
|
|
43
|
-
],
|
|
44
|
-
}),
|
|
45
|
-
],
|
|
46
|
-
});
|
|
11
|
+
function createParamsDetails({ parameters }) {
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("ParamsDetails", {
|
|
14
|
+
parameters: parameters,
|
|
15
|
+
}),
|
|
16
|
+
"\n\n",
|
|
17
|
+
];
|
|
47
18
|
}
|
|
48
19
|
exports.createParamsDetails = createParamsDetails;
|
|
@@ -10,5 +10,5 @@ interface Props {
|
|
|
10
10
|
required?: string[] | boolean;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
export declare function createRequestSchema({ title, body, ...rest }: Props): string
|
|
13
|
+
export declare function createRequestSchema({ title, body, ...rest }: Props): string[];
|
|
14
14
|
export {};
|
|
@@ -7,139 +7,15 @@
|
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createRequestSchema = void 0;
|
|
10
|
-
const createDescription_1 = require("./createDescription");
|
|
11
|
-
const createDetails_1 = require("./createDetails");
|
|
12
|
-
const createDetailsSummary_1 = require("./createDetailsSummary");
|
|
13
|
-
const createSchema_1 = require("./createSchema");
|
|
14
10
|
const utils_1 = require("./utils");
|
|
15
11
|
function createRequestSchema({ title, body, ...rest }) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const mimeTypes = Object.keys(body.content);
|
|
25
|
-
if (mimeTypes && mimeTypes.length > 1) {
|
|
26
|
-
return (0, utils_1.create)("MimeTabs", {
|
|
27
|
-
className: "openapi-tabs__mime",
|
|
28
|
-
schemaType: "request",
|
|
29
|
-
children: mimeTypes.map((mimeType) => {
|
|
30
|
-
const firstBody = body.content[mimeType].schema;
|
|
31
|
-
if (firstBody === undefined) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
if (firstBody.properties !== undefined) {
|
|
35
|
-
if (Object.keys(firstBody.properties).length === 0) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return (0, utils_1.create)("TabItem", {
|
|
40
|
-
label: mimeType,
|
|
41
|
-
value: `${mimeType}`,
|
|
42
|
-
children: [
|
|
43
|
-
(0, createDetails_1.createDetails)({
|
|
44
|
-
className: "openapi-markdown__details mime",
|
|
45
|
-
"data-collapsed": false,
|
|
46
|
-
open: true,
|
|
47
|
-
...rest,
|
|
48
|
-
children: [
|
|
49
|
-
(0, createDetailsSummary_1.createDetailsSummary)({
|
|
50
|
-
className: "openapi-markdown__details-summary-mime",
|
|
51
|
-
children: [
|
|
52
|
-
(0, utils_1.create)("h3", {
|
|
53
|
-
className: "openapi-markdown__details-summary-header-body",
|
|
54
|
-
children: `${title}`,
|
|
55
|
-
}),
|
|
56
|
-
(0, utils_1.guard)(body.required && body.required === true, () => [
|
|
57
|
-
(0, utils_1.create)("span", {
|
|
58
|
-
className: "openapi-schema__required",
|
|
59
|
-
children: "required",
|
|
60
|
-
}),
|
|
61
|
-
]),
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
(0, utils_1.create)("div", {
|
|
65
|
-
style: { textAlign: "left", marginLeft: "1rem" },
|
|
66
|
-
children: [
|
|
67
|
-
(0, utils_1.guard)(body.description, () => [
|
|
68
|
-
(0, utils_1.create)("div", {
|
|
69
|
-
style: { marginTop: "1rem", marginBottom: "1rem" },
|
|
70
|
-
children: (0, createDescription_1.createDescription)(body.description),
|
|
71
|
-
}),
|
|
72
|
-
]),
|
|
73
|
-
],
|
|
74
|
-
}),
|
|
75
|
-
(0, utils_1.create)("ul", {
|
|
76
|
-
style: { marginLeft: "1rem" },
|
|
77
|
-
children: (0, createSchema_1.createNodes)(firstBody, "request"),
|
|
78
|
-
}),
|
|
79
|
-
],
|
|
80
|
-
}),
|
|
81
|
-
],
|
|
82
|
-
});
|
|
83
|
-
}),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
const randomFirstKey = Object.keys(body.content)[0];
|
|
87
|
-
const firstBody = (_a = body.content[randomFirstKey].schema) !== null && _a !== void 0 ? _a : body.content[randomFirstKey];
|
|
88
|
-
if (firstBody === undefined) {
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
return (0, utils_1.create)("MimeTabs", {
|
|
92
|
-
className: "openapi-tabs__mime",
|
|
93
|
-
children: [
|
|
94
|
-
(0, utils_1.create)("TabItem", {
|
|
95
|
-
label: randomFirstKey,
|
|
96
|
-
value: `${randomFirstKey}-schema`,
|
|
97
|
-
children: [
|
|
98
|
-
(0, createDetails_1.createDetails)({
|
|
99
|
-
className: "openapi-markdown__details mime",
|
|
100
|
-
"data-collapsed": false,
|
|
101
|
-
open: true,
|
|
102
|
-
...rest,
|
|
103
|
-
children: [
|
|
104
|
-
(0, createDetailsSummary_1.createDetailsSummary)({
|
|
105
|
-
className: "openapi-markdown__details-summary-mime",
|
|
106
|
-
children: [
|
|
107
|
-
(0, utils_1.create)("h3", {
|
|
108
|
-
className: "openapi-markdown__details-summary-header-body",
|
|
109
|
-
children: `${title}`,
|
|
110
|
-
}),
|
|
111
|
-
(0, utils_1.guard)(firstBody.type === "array", (format) => (0, utils_1.create)("span", {
|
|
112
|
-
style: { opacity: "0.6" },
|
|
113
|
-
children: ` array`,
|
|
114
|
-
})),
|
|
115
|
-
(0, utils_1.guard)(body.required, () => [
|
|
116
|
-
(0, utils_1.create)("strong", {
|
|
117
|
-
className: "openapi-schema__required",
|
|
118
|
-
children: "required",
|
|
119
|
-
}),
|
|
120
|
-
]),
|
|
121
|
-
],
|
|
122
|
-
}),
|
|
123
|
-
(0, utils_1.create)("div", {
|
|
124
|
-
style: { textAlign: "left", marginLeft: "1rem" },
|
|
125
|
-
children: [
|
|
126
|
-
(0, utils_1.guard)(body.description, () => [
|
|
127
|
-
(0, utils_1.create)("div", {
|
|
128
|
-
style: { marginTop: "1rem", marginBottom: "1rem" },
|
|
129
|
-
children: (0, createDescription_1.createDescription)(body.description),
|
|
130
|
-
}),
|
|
131
|
-
]),
|
|
132
|
-
],
|
|
133
|
-
}),
|
|
134
|
-
(0, utils_1.create)("ul", {
|
|
135
|
-
style: { marginLeft: "1rem" },
|
|
136
|
-
children: (0, createSchema_1.createNodes)(firstBody, "request"),
|
|
137
|
-
}),
|
|
138
|
-
],
|
|
139
|
-
}),
|
|
140
|
-
],
|
|
141
|
-
}),
|
|
142
|
-
],
|
|
143
|
-
});
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("RequestSchema", {
|
|
14
|
+
title: title,
|
|
15
|
+
body: body,
|
|
16
|
+
...rest,
|
|
17
|
+
}),
|
|
18
|
+
"\n\n",
|
|
19
|
+
];
|
|
144
20
|
}
|
|
145
21
|
exports.createRequestSchema = createRequestSchema;
|
|
@@ -10,5 +10,5 @@ interface Props {
|
|
|
10
10
|
required?: string[] | boolean;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
export declare function createResponseSchema({ title, body, ...rest }: Props): string
|
|
13
|
+
export declare function createResponseSchema({ title, body, ...rest }: Props): string[];
|
|
14
14
|
export {};
|
|
@@ -7,101 +7,15 @@
|
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createResponseSchema = void 0;
|
|
10
|
-
const createDescription_1 = require("./createDescription");
|
|
11
|
-
const createDetails_1 = require("./createDetails");
|
|
12
|
-
const createDetailsSummary_1 = require("./createDetailsSummary");
|
|
13
|
-
const createSchema_1 = require("./createSchema");
|
|
14
|
-
const createStatusCodes_1 = require("./createStatusCodes");
|
|
15
10
|
const utils_1 = require("./utils");
|
|
16
11
|
function createResponseSchema({ title, body, ...rest }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (mimeTypes && mimeTypes.length) {
|
|
26
|
-
return (0, utils_1.create)("MimeTabs", {
|
|
27
|
-
className: "openapi-tabs__mime",
|
|
28
|
-
schemaType: "response",
|
|
29
|
-
children: mimeTypes.map((mimeType) => {
|
|
30
|
-
var _a;
|
|
31
|
-
const responseExamples = body.content[mimeType].examples;
|
|
32
|
-
const responseExample = body.content[mimeType].example;
|
|
33
|
-
const firstBody = (_a = body.content[mimeType].schema) !== null && _a !== void 0 ? _a : body.content[mimeType];
|
|
34
|
-
if (firstBody === undefined &&
|
|
35
|
-
responseExample === undefined &&
|
|
36
|
-
responseExamples === undefined) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
return (0, utils_1.create)("TabItem", {
|
|
40
|
-
label: `${mimeType}`,
|
|
41
|
-
value: `${mimeType}`,
|
|
42
|
-
children: [
|
|
43
|
-
(0, utils_1.create)("SchemaTabs", {
|
|
44
|
-
className: "openapi-tabs__schema",
|
|
45
|
-
// TODO: determine if we should persist this
|
|
46
|
-
// groupId: "schema-tabs",
|
|
47
|
-
children: [
|
|
48
|
-
firstBody &&
|
|
49
|
-
(0, utils_1.create)("TabItem", {
|
|
50
|
-
label: `${title}`,
|
|
51
|
-
value: `${title}`,
|
|
52
|
-
children: [
|
|
53
|
-
(0, createDetails_1.createDetails)({
|
|
54
|
-
className: "openapi-markdown__details response",
|
|
55
|
-
"data-collapsed": false,
|
|
56
|
-
open: true,
|
|
57
|
-
...rest,
|
|
58
|
-
children: [
|
|
59
|
-
(0, createDetailsSummary_1.createDetailsSummary)({
|
|
60
|
-
className: "openapi-markdown__details-summary-response",
|
|
61
|
-
children: [
|
|
62
|
-
(0, utils_1.create)("strong", { children: `${title}` }),
|
|
63
|
-
(0, utils_1.guard)(body.required && body.required === true, () => [
|
|
64
|
-
(0, utils_1.create)("span", {
|
|
65
|
-
className: "openapi-schema__required",
|
|
66
|
-
children: "required",
|
|
67
|
-
}),
|
|
68
|
-
]),
|
|
69
|
-
],
|
|
70
|
-
}),
|
|
71
|
-
(0, utils_1.create)("div", {
|
|
72
|
-
style: { textAlign: "left", marginLeft: "1rem" },
|
|
73
|
-
children: [
|
|
74
|
-
(0, utils_1.guard)(body.description, () => [
|
|
75
|
-
(0, utils_1.create)("div", {
|
|
76
|
-
style: {
|
|
77
|
-
marginTop: "1rem",
|
|
78
|
-
marginBottom: "1rem",
|
|
79
|
-
},
|
|
80
|
-
children: (0, createDescription_1.createDescription)(body.description),
|
|
81
|
-
}),
|
|
82
|
-
]),
|
|
83
|
-
],
|
|
84
|
-
}),
|
|
85
|
-
(0, utils_1.create)("ul", {
|
|
86
|
-
style: { marginLeft: "1rem" },
|
|
87
|
-
children: (0, createSchema_1.createNodes)(firstBody, "response"),
|
|
88
|
-
}),
|
|
89
|
-
],
|
|
90
|
-
}),
|
|
91
|
-
],
|
|
92
|
-
}),
|
|
93
|
-
firstBody && (0, createStatusCodes_1.createExampleFromSchema)(firstBody, mimeType),
|
|
94
|
-
responseExamples &&
|
|
95
|
-
(0, createStatusCodes_1.createResponseExamples)(responseExamples, mimeType),
|
|
96
|
-
responseExample &&
|
|
97
|
-
(0, createStatusCodes_1.createResponseExample)(responseExample, mimeType),
|
|
98
|
-
],
|
|
99
|
-
}),
|
|
100
|
-
],
|
|
101
|
-
});
|
|
102
|
-
}),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return undefined;
|
|
12
|
+
return [
|
|
13
|
+
(0, utils_1.create)("ResponseSchema", {
|
|
14
|
+
title: title,
|
|
15
|
+
body: body,
|
|
16
|
+
...rest,
|
|
17
|
+
}),
|
|
18
|
+
"\n\n",
|
|
19
|
+
];
|
|
106
20
|
}
|
|
107
21
|
exports.createResponseSchema = createResponseSchema;
|
|
@@ -2,10 +2,7 @@ import { SchemaObject } from "../openapi/types";
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns a merged representation of allOf array of schemas.
|
|
4
4
|
*/
|
|
5
|
-
export declare function mergeAllOf(allOf: SchemaObject
|
|
6
|
-
mergedSchemas: any;
|
|
7
|
-
mergedRequired: any;
|
|
8
|
-
};
|
|
5
|
+
export declare function mergeAllOf(allOf: SchemaObject): SchemaObject;
|
|
9
6
|
/**
|
|
10
7
|
* Creates a hierarchical level of a schema tree. Nodes produce edges that can branch into sub-nodes with edges, recursively.
|
|
11
8
|
*/
|