docusaurus-plugin-openapi-docs 3.0.0-beta.2 → 3.0.0-beta.4
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.js +15 -12
- package/lib/markdown/createDeprecationNotice.js +6 -3
- package/lib/markdown/createDescription.js +1 -9
- package/lib/markdown/createHeading.js +1 -3
- package/lib/markdown/createSchema.test.js +2 -2
- package/lib/markdown/createStatusCodes.js +1 -1
- package/lib/markdown/index.js +2 -2
- package/lib/markdown/utils.d.ts +5 -2
- package/lib/markdown/utils.js +22 -1
- package/lib/openapi/openapi.d.ts +1 -1
- package/lib/openapi/openapi.js +1 -1
- package/lib/openapi/types.d.ts +13 -13
- package/lib/openapi/utils/services/OpenAPIParser.d.ts +1 -1
- package/lib/openapi/utils/services/OpenAPIParser.js +2 -1
- package/lib/openapi/utils/services/RedocNormalizedOptions.js +49 -49
- package/lib/openapi/utils/types/index.d.ts +1 -1
- package/lib/openapi/utils/types/open-api.d.ts +4 -4
- package/lib/openapi/utils/types.d.ts +5 -5
- package/lib/openapi/utils/utils/openapi.js +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +9 -7
- package/src/index.ts +24 -14
- package/src/markdown/createAuthentication.ts +1 -1
- package/src/markdown/createContactInfo.ts +1 -1
- package/src/markdown/createDeprecationNotice.ts +2 -2
- package/src/markdown/createDescription.ts +2 -10
- package/src/markdown/createHeading.ts +2 -4
- package/src/markdown/createLicense.ts +1 -1
- package/src/markdown/createLogo.ts +1 -1
- package/src/markdown/createParamsDetails.ts +1 -1
- package/src/markdown/createRequestBodyDetails.ts +1 -1
- package/src/markdown/createRequestSchema.ts +1 -1
- package/src/markdown/createResponseSchema.ts +1 -1
- package/src/markdown/createSchema.test.ts +6 -4
- package/src/markdown/createSchema.ts +1 -1
- package/src/markdown/createStatusCodes.ts +2 -2
- package/src/markdown/index.ts +10 -10
- package/src/markdown/utils.ts +22 -0
- package/src/openapi/createRequestExample.ts +1 -1
- package/src/openapi/createResponseExample.ts +1 -1
- package/src/openapi/openapi.ts +3 -3
- package/src/openapi/utils/loadAndResolveSpec.ts +1 -1
- package/src/openapi/utils/services/OpenAPIParser.ts +3 -3
- package/src/openapi/utils/utils/openapi.ts +8 -8
- package/src/sidebars/index.ts +1 -0
package/lib/index.js
CHANGED
|
@@ -15,6 +15,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
15
15
|
const zlib_1 = __importDefault(require("zlib"));
|
|
16
16
|
const utils_1 = require("@docusaurus/utils");
|
|
17
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
const json5_1 = __importDefault(require("json5"));
|
|
18
19
|
const mustache_1 = require("mustache");
|
|
19
20
|
const markdown_1 = require("./markdown");
|
|
20
21
|
const openapi_1 = require("./openapi");
|
|
@@ -105,17 +106,19 @@ function pluginOpenAPIDocs(context, options) {
|
|
|
105
106
|
// TODO: figure out better way to set default
|
|
106
107
|
if (Object.keys(sidebarOptions !== null && sidebarOptions !== void 0 ? sidebarOptions : {}).length > 0) {
|
|
107
108
|
const sidebarSlice = (0, sidebars_1.default)(sidebarOptions, options, loadedApi, tags, docPath);
|
|
108
|
-
|
|
109
|
+
let sidebarSliceTemplate = `import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";\n\n`;
|
|
110
|
+
sidebarSliceTemplate += `const sidebar: SidebarsConfig = {{{slice}}};\n\n`;
|
|
111
|
+
sidebarSliceTemplate += `export default sidebar.apisidebar;\n`;
|
|
109
112
|
const view = (0, mustache_1.render)(sidebarSliceTemplate, {
|
|
110
|
-
slice:
|
|
113
|
+
slice: json5_1.default.stringify({ apisidebar: sidebarSlice }, { space: 2, quote: '"' }),
|
|
111
114
|
});
|
|
112
|
-
if (!fs_1.default.existsSync(`${outputDir}/sidebar.
|
|
115
|
+
if (!fs_1.default.existsSync(`${outputDir}/sidebar.ts`)) {
|
|
113
116
|
try {
|
|
114
|
-
fs_1.default.writeFileSync(`${outputDir}/sidebar.
|
|
115
|
-
console.log(chalk_1.default.green(`Successfully created "${outputDir}/sidebar.
|
|
117
|
+
fs_1.default.writeFileSync(`${outputDir}/sidebar.ts`, view, "utf8");
|
|
118
|
+
console.log(chalk_1.default.green(`Successfully created "${outputDir}/sidebar.ts"`));
|
|
116
119
|
}
|
|
117
120
|
catch (err) {
|
|
118
|
-
console.error(chalk_1.default.red(`Failed to write "${outputDir}/sidebar.
|
|
121
|
+
console.error(chalk_1.default.red(`Failed to write "${outputDir}/sidebar.ts"`), chalk_1.default.yellow(err));
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -290,7 +293,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
290
293
|
cwd: path_1.default.resolve(apiDir),
|
|
291
294
|
deep: 1,
|
|
292
295
|
});
|
|
293
|
-
const sidebarFile = await (0, utils_1.Globby)(["sidebar.
|
|
296
|
+
const sidebarFile = await (0, utils_1.Globby)(["sidebar.ts"], {
|
|
294
297
|
cwd: path_1.default.resolve(apiDir),
|
|
295
298
|
deep: 1,
|
|
296
299
|
});
|
|
@@ -322,7 +325,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
322
325
|
}
|
|
323
326
|
const versionsJson = JSON.stringify(versionsArray, null, 2);
|
|
324
327
|
try {
|
|
325
|
-
fs_1.default.writeFileSync(`${outputDir}/versions.json`, versionsJson, "utf8");
|
|
328
|
+
fs_1.default.writeFileSync(`${outputDir}/versions.json`, versionsJson + "\n", "utf8");
|
|
326
329
|
console.log(chalk_1.default.green(`Successfully created "${outputDir}/versions.json"`));
|
|
327
330
|
}
|
|
328
331
|
catch (err) {
|
|
@@ -346,7 +349,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
346
349
|
extendCli(cli) {
|
|
347
350
|
cli
|
|
348
351
|
.command(`gen-api-docs`)
|
|
349
|
-
.description(`Generates OpenAPI docs in MDX file format and sidebar.
|
|
352
|
+
.description(`Generates OpenAPI docs in MDX file format and sidebar.ts (if enabled).`)
|
|
350
353
|
.usage("<id>")
|
|
351
354
|
.arguments("<id>")
|
|
352
355
|
.option("-p, --plugin-id <plugin>", "OpenAPI docs plugin ID.")
|
|
@@ -394,7 +397,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
394
397
|
});
|
|
395
398
|
cli
|
|
396
399
|
.command(`gen-api-docs:version`)
|
|
397
|
-
.description(`Generates versioned OpenAPI docs in MDX file format, versions.js and sidebar.
|
|
400
|
+
.description(`Generates versioned OpenAPI docs in MDX file format, versions.js and sidebar.ts (if enabled).`)
|
|
398
401
|
.usage("<id:version>")
|
|
399
402
|
.arguments("<id:version>")
|
|
400
403
|
.option("-p, --plugin-id <plugin>", "OpenAPI docs plugin ID.")
|
|
@@ -469,7 +472,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
469
472
|
});
|
|
470
473
|
cli
|
|
471
474
|
.command(`clean-api-docs`)
|
|
472
|
-
.description(`Clears the generated OpenAPI docs MDX files and sidebar.
|
|
475
|
+
.description(`Clears the generated OpenAPI docs MDX files and sidebar.ts (if enabled).`)
|
|
473
476
|
.usage("<id>")
|
|
474
477
|
.arguments("<id>")
|
|
475
478
|
.option("-p, --plugin-id <plugin>", "OpenAPI docs plugin ID.")
|
|
@@ -512,7 +515,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
512
515
|
});
|
|
513
516
|
cli
|
|
514
517
|
.command(`clean-api-docs:version`)
|
|
515
|
-
.description(`Clears the versioned, generated OpenAPI docs MDX files, versions.json and sidebar.
|
|
518
|
+
.description(`Clears the versioned, generated OpenAPI docs MDX files, versions.json and sidebar.ts (if enabled).`)
|
|
516
519
|
.usage("<id:version>")
|
|
517
520
|
.arguments("<id:version>")
|
|
518
521
|
.option("-p, --plugin-id <plugin>", "OpenAPI docs plugin ID.")
|
|
@@ -12,8 +12,11 @@ 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
|
-
|
|
15
|
+
return (0, utils_1.guard)(deprecated, () => {
|
|
16
|
+
var _a;
|
|
17
|
+
return createAdmonition({
|
|
18
|
+
children: (_a = (0, utils_1.clean)(description)) !== null && _a !== void 0 ? _a : "This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
|
|
19
|
+
});
|
|
20
|
+
});
|
|
18
21
|
}
|
|
19
22
|
exports.createDeprecationNotice = createDeprecationNotice;
|
|
@@ -9,14 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.createDescription = void 0;
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
function createDescription(description) {
|
|
12
|
-
|
|
13
|
-
return "";
|
|
14
|
-
}
|
|
15
|
-
return `\n\n${description
|
|
16
|
-
.replace(utils_1.lessThan, "<")
|
|
17
|
-
.replace(utils_1.greaterThan, ">")
|
|
18
|
-
.replace(utils_1.codeFence, function (match) {
|
|
19
|
-
return match.replace(/\\>/g, ">");
|
|
20
|
-
})}\n\n`;
|
|
12
|
+
return `\n\n${(0, utils_1.clean)(description)}\n\n`;
|
|
21
13
|
}
|
|
22
14
|
exports.createDescription = createDescription;
|
|
@@ -12,9 +12,7 @@ function createHeading(heading) {
|
|
|
12
12
|
return [
|
|
13
13
|
(0, utils_1.create)("h1", {
|
|
14
14
|
className: "openapi__heading",
|
|
15
|
-
children:
|
|
16
|
-
.replace(utils_1.lessThan, "<")
|
|
17
|
-
.replace(utils_1.greaterThan, ">")}`,
|
|
15
|
+
children: (0, utils_1.clean)(heading),
|
|
18
16
|
}),
|
|
19
17
|
`\n\n`,
|
|
20
18
|
];
|
|
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
const prettier = __importStar(require("prettier"));
|
|
33
33
|
const createSchema_1 = require("./createSchema");
|
|
34
34
|
describe("createNodes", () => {
|
|
35
|
-
it("should create readable MODs for oneOf primitive properties", () => {
|
|
35
|
+
it("should create readable MODs for oneOf primitive properties", async () => {
|
|
36
36
|
const schema = {
|
|
37
37
|
type: "object",
|
|
38
38
|
properties: {
|
|
@@ -68,6 +68,6 @@ describe("createNodes", () => {
|
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
|
-
expect((0, createSchema_1.createNodes)(schema, "request").map((md) => prettier.format(md, { parser: "babel" }))).toMatchSnapshot();
|
|
71
|
+
expect(await Promise.all((0, createSchema_1.createNodes)(schema, "request").map(async (md) => await prettier.format(md, { parser: "babel" })))).toMatchSnapshot();
|
|
72
72
|
});
|
|
73
73
|
});
|
|
@@ -11,13 +11,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createStatusCodes = exports.createExampleFromSchema = exports.createResponseExample = exports.createResponseExamples = void 0;
|
|
13
13
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
14
|
-
const createResponseExample_1 = require("../openapi/createResponseExample");
|
|
15
14
|
const createDescription_1 = require("./createDescription");
|
|
16
15
|
const createDetails_1 = require("./createDetails");
|
|
17
16
|
const createDetailsSummary_1 = require("./createDetailsSummary");
|
|
18
17
|
const createResponseSchema_1 = require("./createResponseSchema");
|
|
19
18
|
const utils_1 = require("./utils");
|
|
20
19
|
const utils_2 = require("./utils");
|
|
20
|
+
const createResponseExample_1 = require("../openapi/createResponseExample");
|
|
21
21
|
function json2xml(o, tab) {
|
|
22
22
|
var toXml = function (v, name, ind) {
|
|
23
23
|
var xml = "";
|
package/lib/markdown/index.js
CHANGED
|
@@ -37,7 +37,7 @@ function createApiPageMD({ title, api: { deprecated, "x-deprecated-description":
|
|
|
37
37
|
`import SchemaItem from "@theme/SchemaItem";\n`,
|
|
38
38
|
`import SchemaTabs from "@theme/SchemaTabs";\n`,
|
|
39
39
|
`import TabItem from "@theme/TabItem";\n\n`,
|
|
40
|
-
(0, createHeading_1.createHeading)(title
|
|
40
|
+
(0, createHeading_1.createHeading)(title),
|
|
41
41
|
(0, createMethodEndpoint_1.createMethodEndpoint)(method, path),
|
|
42
42
|
infoPath && (0, createAuthorization_1.createAuthorization)(infoPath),
|
|
43
43
|
frontMatter.show_extensions && (0, createVendorExtensions_1.createVendorExtensions)(extensions),
|
|
@@ -64,7 +64,7 @@ function createInfoPageMD({ info: { title, version, description, contact, licens
|
|
|
64
64
|
`import Export from "@theme/ApiExplorer/Export";\n\n`,
|
|
65
65
|
(0, createVersionBadge_1.createVersionBadge)(version),
|
|
66
66
|
(0, createDownload_1.createDownload)(downloadUrl),
|
|
67
|
-
(0, createHeading_1.createHeading)(title
|
|
67
|
+
(0, createHeading_1.createHeading)(title),
|
|
68
68
|
(0, createLogo_1.createLogo)(logo, darkLogo),
|
|
69
69
|
(0, createDescription_1.createDescription)(description),
|
|
70
70
|
(0, createAuthentication_1.createAuthentication)(securitySchemes),
|
package/lib/markdown/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type Children = string | undefined | (string | string[] | undefined)[];
|
|
2
|
+
export type Props = Record<string, any> & {
|
|
3
3
|
children?: Children;
|
|
4
4
|
};
|
|
5
5
|
export declare function create(tag: string, props: Props): string;
|
|
@@ -8,3 +8,6 @@ export declare function render(children: Children): string;
|
|
|
8
8
|
export declare const lessThan: RegExp;
|
|
9
9
|
export declare const greaterThan: RegExp;
|
|
10
10
|
export declare const codeFence: RegExp;
|
|
11
|
+
export declare const curlyBrackets: RegExp;
|
|
12
|
+
export declare const codeBlock: RegExp;
|
|
13
|
+
export declare function clean(value: string | undefined): string;
|
package/lib/markdown/utils.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.codeFence = exports.greaterThan = exports.lessThan = exports.render = exports.guard = exports.create = void 0;
|
|
9
|
+
exports.clean = exports.codeBlock = exports.curlyBrackets = exports.codeFence = exports.greaterThan = exports.lessThan = exports.render = exports.guard = exports.create = void 0;
|
|
10
10
|
function create(tag, props) {
|
|
11
11
|
const { children, ...rest } = props;
|
|
12
12
|
let propString = "";
|
|
@@ -41,3 +41,24 @@ exports.render = render;
|
|
|
41
41
|
exports.lessThan = /<=?(?!(=|button|\s?\/button|code|\s?\/code|details|\s?\/details|summary|\s?\/summary|hr|\s?\/hr|br|\s?\/br|span|\s?\/span|strong|\s?\/strong|small|\s?\/small|table|\s?\/table|thead|\s?\/thead|tbody|\s?\/tbody|td|\s?\/td|tr|\s?\/tr|th|\s?\/th|h1|\s?\/h1|h2|\s?\/h2|h3|\s?\/h3|h4|\s?\/h4|h5|\s?\/h5|h6|\s?\/h6|title|\s?\/title|p|\s?\/p|em|\s?\/em|b|\s?\/b|i|\s?\/i|u|\s?\/u|strike|\s?\/strike|bold|\s?\/bold|a|\s?\/a|table|\s?\/table|li|\s?\/li|ol|\s?\/ol|ul|\s?\/ul|img|\s?\/img|svg|\s?\/svg|div|\s?\/div|center|\s?\/center))/gu;
|
|
42
42
|
exports.greaterThan = /(?<!(button|code|details|summary|hr|br|span|strong|small|table|thead|tbody|td|tr|th|h1|h2|h3|h4|h5|h6|title|p|em|b|i|u|strike|bold|a|li|ol|ul|img|svg|div|center|\/|\s|"|'))>/gu;
|
|
43
43
|
exports.codeFence = /`{1,3}[\s\S]*?`{1,3}/g;
|
|
44
|
+
exports.curlyBrackets = /([{|}])/g;
|
|
45
|
+
exports.codeBlock = /(^```.*[\s\S]*?```$|`[^`].+?`)/gm;
|
|
46
|
+
function clean(value) {
|
|
47
|
+
if (!value) {
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
let sections = value.split(exports.codeBlock);
|
|
51
|
+
for (let sectionIndex in sections) {
|
|
52
|
+
if (!sections[sectionIndex].startsWith("`")) {
|
|
53
|
+
sections[sectionIndex] = sections[sectionIndex]
|
|
54
|
+
.replace(exports.lessThan, "<")
|
|
55
|
+
.replace(exports.greaterThan, ">")
|
|
56
|
+
.replace(exports.codeFence, function (match) {
|
|
57
|
+
return match.replace(/\\>/g, ">");
|
|
58
|
+
})
|
|
59
|
+
.replace(exports.curlyBrackets, "\\$1");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return sections.join("");
|
|
63
|
+
}
|
|
64
|
+
exports.clean = clean;
|
package/lib/openapi/openapi.d.ts
CHANGED
package/lib/openapi/openapi.js
CHANGED
|
@@ -20,9 +20,9 @@ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
|
20
20
|
const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
|
|
21
21
|
const unionBy_1 = __importDefault(require("lodash/unionBy"));
|
|
22
22
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
23
|
-
const index_1 = require("../index");
|
|
24
23
|
const createRequestExample_1 = require("./createRequestExample");
|
|
25
24
|
const loadAndResolveSpec_1 = require("./utils/loadAndResolveSpec");
|
|
25
|
+
const index_1 = require("../index");
|
|
26
26
|
/**
|
|
27
27
|
* Convenience function for converting raw JSON to a Postman Collection object.
|
|
28
28
|
*/
|
package/lib/openapi/types.d.ts
CHANGED
|
@@ -81,8 +81,8 @@ export interface ComponentsObjectWithRef {
|
|
|
81
81
|
links?: Map<LinkObject | ReferenceObject>;
|
|
82
82
|
callbacks?: Map<CallbackObjectWithRef | ReferenceObject>;
|
|
83
83
|
}
|
|
84
|
-
export
|
|
85
|
-
export
|
|
84
|
+
export type PathsObject = Map<PathItemObject>;
|
|
85
|
+
export type PathsObjectWithRef = Map<PathItemObjectWithRef>;
|
|
86
86
|
export interface PathItemObject {
|
|
87
87
|
$ref?: string;
|
|
88
88
|
summary?: string;
|
|
@@ -214,8 +214,8 @@ export interface EncodingObjectWithRef {
|
|
|
214
214
|
explode?: boolean;
|
|
215
215
|
allowReserved?: boolean;
|
|
216
216
|
}
|
|
217
|
-
export
|
|
218
|
-
export
|
|
217
|
+
export type ResponsesObject = Map<ResponseObject>;
|
|
218
|
+
export type ResponsesObjectWithRef = Map<ResponseObjectWithRef | ReferenceObject>;
|
|
219
219
|
export interface ResponseObject {
|
|
220
220
|
description: string;
|
|
221
221
|
headers?: Map<HeaderObject>;
|
|
@@ -228,8 +228,8 @@ export interface ResponseObjectWithRef {
|
|
|
228
228
|
content?: Map<MediaTypeObjectWithRef>;
|
|
229
229
|
links?: Map<LinkObject | ReferenceObject>;
|
|
230
230
|
}
|
|
231
|
-
export
|
|
232
|
-
export
|
|
231
|
+
export type CallbackObject = Map<PathItemObject>;
|
|
232
|
+
export type CallbackObjectWithRef = Map<PathItemObjectWithRef>;
|
|
233
233
|
export interface ExampleObject {
|
|
234
234
|
summary?: string;
|
|
235
235
|
description?: string;
|
|
@@ -244,8 +244,8 @@ export interface LinkObject {
|
|
|
244
244
|
description?: string;
|
|
245
245
|
server?: ServerObject;
|
|
246
246
|
}
|
|
247
|
-
export
|
|
248
|
-
export
|
|
247
|
+
export type HeaderObject = Omit<ParameterObject, "name" | "in">;
|
|
248
|
+
export type HeaderObjectWithRef = Omit<ParameterObjectWithRef, "name" | "in">;
|
|
249
249
|
export interface TagObject {
|
|
250
250
|
name?: string;
|
|
251
251
|
description?: string;
|
|
@@ -255,8 +255,8 @@ export interface TagObject {
|
|
|
255
255
|
export interface ReferenceObject {
|
|
256
256
|
$ref: string;
|
|
257
257
|
}
|
|
258
|
-
export
|
|
259
|
-
export
|
|
258
|
+
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
259
|
+
export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
260
260
|
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
261
261
|
allOf?: SchemaObject[];
|
|
262
262
|
oneOf?: SchemaObject[];
|
|
@@ -274,7 +274,7 @@ export declare type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" |
|
|
|
274
274
|
example?: any;
|
|
275
275
|
deprecated?: boolean;
|
|
276
276
|
};
|
|
277
|
-
export
|
|
277
|
+
export type SchemaObjectWithRef = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
278
278
|
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
279
279
|
allOf?: (SchemaObject | ReferenceObject)[];
|
|
280
280
|
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
@@ -303,7 +303,7 @@ export interface XMLObject {
|
|
|
303
303
|
attribute?: boolean;
|
|
304
304
|
wrapped?: boolean;
|
|
305
305
|
}
|
|
306
|
-
export
|
|
306
|
+
export type SecuritySchemeObject = ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject;
|
|
307
307
|
export interface ApiKeySecuritySchemeObject {
|
|
308
308
|
type: "apiKey";
|
|
309
309
|
description?: string;
|
|
@@ -340,5 +340,5 @@ export interface OAuthFlowObject {
|
|
|
340
340
|
refreshUrl?: string;
|
|
341
341
|
scopes: Map<string>;
|
|
342
342
|
}
|
|
343
|
-
export
|
|
343
|
+
export type SecurityRequirementObject = Map<string[]>;
|
|
344
344
|
export {};
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.OpenAPIParser = void 0;
|
|
10
|
+
// @ts-nocheck
|
|
11
|
+
const RedocNormalizedOptions_1 = require("./RedocNormalizedOptions");
|
|
10
12
|
const helpers_1 = require("../utils/helpers");
|
|
11
13
|
const JsonPointer_1 = require("../utils/JsonPointer");
|
|
12
14
|
const openapi_1 = require("../utils/openapi");
|
|
13
|
-
const RedocNormalizedOptions_1 = require("./RedocNormalizedOptions");
|
|
14
15
|
/**
|
|
15
16
|
* Helper class to keep track of visited references to avoid
|
|
16
17
|
* endless recursion because of circular refs
|
|
@@ -39,55 +39,6 @@ function argValueToExpandLevel(value, defaultValue = 0) {
|
|
|
39
39
|
return argValueToNumber(value) || defaultValue;
|
|
40
40
|
}
|
|
41
41
|
class RedocNormalizedOptions {
|
|
42
|
-
constructor(raw, defaults = {}) {
|
|
43
|
-
var _a;
|
|
44
|
-
raw = { ...defaults, ...raw };
|
|
45
|
-
this.hideHostname = RedocNormalizedOptions.normalizeHideHostname(raw.hideHostname);
|
|
46
|
-
this.expandResponses = RedocNormalizedOptions.normalizeExpandResponses(raw.expandResponses);
|
|
47
|
-
this.requiredPropsFirst = argValueToBoolean(raw.requiredPropsFirst);
|
|
48
|
-
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
|
49
|
-
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
|
50
|
-
this.sortOperationsAlphabetically = argValueToBoolean(raw.sortOperationsAlphabetically);
|
|
51
|
-
this.sortTagsAlphabetically = argValueToBoolean(raw.sortTagsAlphabetically);
|
|
52
|
-
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
|
53
|
-
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
|
54
|
-
this.untrustedSpec = argValueToBoolean(raw.untrustedSpec);
|
|
55
|
-
this.hideDownloadButton = argValueToBoolean(raw.hideDownloadButton);
|
|
56
|
-
this.downloadFileName = raw.downloadFileName;
|
|
57
|
-
this.downloadDefinitionUrl = raw.downloadDefinitionUrl;
|
|
58
|
-
this.disableSearch = argValueToBoolean(raw.disableSearch);
|
|
59
|
-
this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples);
|
|
60
|
-
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
|
61
|
-
this.sideNavStyle = RedocNormalizedOptions.normalizeSideNavStyle(raw.sideNavStyle);
|
|
62
|
-
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
|
63
|
-
this.menuToggle = argValueToBoolean(raw.menuToggle, true);
|
|
64
|
-
this.jsonSampleExpandLevel =
|
|
65
|
-
RedocNormalizedOptions.normalizeJsonSampleExpandLevel(raw.jsonSampleExpandLevel);
|
|
66
|
-
this.enumSkipQuotes = argValueToBoolean(raw.enumSkipQuotes);
|
|
67
|
-
this.hideSchemaTitles = argValueToBoolean(raw.hideSchemaTitles);
|
|
68
|
-
this.simpleOneOfTypeLabel = argValueToBoolean(raw.simpleOneOfTypeLabel);
|
|
69
|
-
this.payloadSampleIdx = RedocNormalizedOptions.normalizePayloadSampleIdx(raw.payloadSampleIdx);
|
|
70
|
-
this.expandSingleSchemaField = argValueToBoolean(raw.expandSingleSchemaField);
|
|
71
|
-
this.schemaExpansionLevel = argValueToExpandLevel(raw.schemaExpansionLevel);
|
|
72
|
-
this.showObjectSchemaExamples = argValueToBoolean(raw.showObjectSchemaExamples);
|
|
73
|
-
this.showSecuritySchemeType = argValueToBoolean(raw.showSecuritySchemeType);
|
|
74
|
-
this.hideSecuritySection = argValueToBoolean(raw.hideSecuritySection);
|
|
75
|
-
this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);
|
|
76
|
-
this.expandDefaultServerVariables = argValueToBoolean(raw.expandDefaultServerVariables);
|
|
77
|
-
this.maxDisplayedEnumValues = argValueToNumber(raw.maxDisplayedEnumValues);
|
|
78
|
-
const ignoreNamedSchemas = (0, helpers_1.isArray)(raw.ignoreNamedSchemas)
|
|
79
|
-
? raw.ignoreNamedSchemas
|
|
80
|
-
: (_a = raw.ignoreNamedSchemas) === null || _a === void 0 ? void 0 : _a.split(",").map((s) => s.trim());
|
|
81
|
-
this.ignoreNamedSchemas = new Set(ignoreNamedSchemas);
|
|
82
|
-
this.hideSchemaPattern = argValueToBoolean(raw.hideSchemaPattern);
|
|
83
|
-
this.generatedPayloadSamplesMaxDepth =
|
|
84
|
-
RedocNormalizedOptions.normalizeGeneratedPayloadSamplesMaxDepth(raw.generatedPayloadSamplesMaxDepth);
|
|
85
|
-
this.nonce = raw.nonce;
|
|
86
|
-
this.hideFab = argValueToBoolean(raw.hideFab);
|
|
87
|
-
this.minCharacterLengthToInitSearch =
|
|
88
|
-
argValueToNumber(raw.minCharacterLengthToInitSearch) || 3;
|
|
89
|
-
this.showWebhookVerb = argValueToBoolean(raw.showWebhookVerb);
|
|
90
|
-
}
|
|
91
42
|
static normalizeExpandResponses(value) {
|
|
92
43
|
if (value === "all") {
|
|
93
44
|
return "all";
|
|
@@ -166,5 +117,54 @@ class RedocNormalizedOptions {
|
|
|
166
117
|
}
|
|
167
118
|
return 10;
|
|
168
119
|
}
|
|
120
|
+
constructor(raw, defaults = {}) {
|
|
121
|
+
var _a;
|
|
122
|
+
raw = { ...defaults, ...raw };
|
|
123
|
+
this.hideHostname = RedocNormalizedOptions.normalizeHideHostname(raw.hideHostname);
|
|
124
|
+
this.expandResponses = RedocNormalizedOptions.normalizeExpandResponses(raw.expandResponses);
|
|
125
|
+
this.requiredPropsFirst = argValueToBoolean(raw.requiredPropsFirst);
|
|
126
|
+
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
|
127
|
+
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
|
128
|
+
this.sortOperationsAlphabetically = argValueToBoolean(raw.sortOperationsAlphabetically);
|
|
129
|
+
this.sortTagsAlphabetically = argValueToBoolean(raw.sortTagsAlphabetically);
|
|
130
|
+
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
|
131
|
+
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
|
132
|
+
this.untrustedSpec = argValueToBoolean(raw.untrustedSpec);
|
|
133
|
+
this.hideDownloadButton = argValueToBoolean(raw.hideDownloadButton);
|
|
134
|
+
this.downloadFileName = raw.downloadFileName;
|
|
135
|
+
this.downloadDefinitionUrl = raw.downloadDefinitionUrl;
|
|
136
|
+
this.disableSearch = argValueToBoolean(raw.disableSearch);
|
|
137
|
+
this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples);
|
|
138
|
+
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
|
139
|
+
this.sideNavStyle = RedocNormalizedOptions.normalizeSideNavStyle(raw.sideNavStyle);
|
|
140
|
+
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
|
141
|
+
this.menuToggle = argValueToBoolean(raw.menuToggle, true);
|
|
142
|
+
this.jsonSampleExpandLevel =
|
|
143
|
+
RedocNormalizedOptions.normalizeJsonSampleExpandLevel(raw.jsonSampleExpandLevel);
|
|
144
|
+
this.enumSkipQuotes = argValueToBoolean(raw.enumSkipQuotes);
|
|
145
|
+
this.hideSchemaTitles = argValueToBoolean(raw.hideSchemaTitles);
|
|
146
|
+
this.simpleOneOfTypeLabel = argValueToBoolean(raw.simpleOneOfTypeLabel);
|
|
147
|
+
this.payloadSampleIdx = RedocNormalizedOptions.normalizePayloadSampleIdx(raw.payloadSampleIdx);
|
|
148
|
+
this.expandSingleSchemaField = argValueToBoolean(raw.expandSingleSchemaField);
|
|
149
|
+
this.schemaExpansionLevel = argValueToExpandLevel(raw.schemaExpansionLevel);
|
|
150
|
+
this.showObjectSchemaExamples = argValueToBoolean(raw.showObjectSchemaExamples);
|
|
151
|
+
this.showSecuritySchemeType = argValueToBoolean(raw.showSecuritySchemeType);
|
|
152
|
+
this.hideSecuritySection = argValueToBoolean(raw.hideSecuritySection);
|
|
153
|
+
this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);
|
|
154
|
+
this.expandDefaultServerVariables = argValueToBoolean(raw.expandDefaultServerVariables);
|
|
155
|
+
this.maxDisplayedEnumValues = argValueToNumber(raw.maxDisplayedEnumValues);
|
|
156
|
+
const ignoreNamedSchemas = (0, helpers_1.isArray)(raw.ignoreNamedSchemas)
|
|
157
|
+
? raw.ignoreNamedSchemas
|
|
158
|
+
: (_a = raw.ignoreNamedSchemas) === null || _a === void 0 ? void 0 : _a.split(",").map((s) => s.trim());
|
|
159
|
+
this.ignoreNamedSchemas = new Set(ignoreNamedSchemas);
|
|
160
|
+
this.hideSchemaPattern = argValueToBoolean(raw.hideSchemaPattern);
|
|
161
|
+
this.generatedPayloadSamplesMaxDepth =
|
|
162
|
+
RedocNormalizedOptions.normalizeGeneratedPayloadSamplesMaxDepth(raw.generatedPayloadSamplesMaxDepth);
|
|
163
|
+
this.nonce = raw.nonce;
|
|
164
|
+
this.hideFab = argValueToBoolean(raw.hideFab);
|
|
165
|
+
this.minCharacterLengthToInitSearch =
|
|
166
|
+
argValueToNumber(raw.minCharacterLengthToInitSearch) || 3;
|
|
167
|
+
this.showWebhookVerb = argValueToBoolean(raw.showWebhookVerb);
|
|
168
|
+
}
|
|
169
169
|
}
|
|
170
170
|
exports.RedocNormalizedOptions = RedocNormalizedOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./open-api";
|
|
2
|
-
export
|
|
2
|
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
@@ -38,7 +38,7 @@ export interface OpenAPIPaths {
|
|
|
38
38
|
export interface OpenAPIRef {
|
|
39
39
|
$ref: string;
|
|
40
40
|
}
|
|
41
|
-
export
|
|
41
|
+
export type Referenced<T> = OpenAPIRef | T;
|
|
42
42
|
export interface OpenAPIPath {
|
|
43
43
|
summary?: string;
|
|
44
44
|
description?: string;
|
|
@@ -182,8 +182,8 @@ export interface OpenAPIEncoding {
|
|
|
182
182
|
explode: boolean;
|
|
183
183
|
allowReserved: boolean;
|
|
184
184
|
}
|
|
185
|
-
export
|
|
186
|
-
export
|
|
185
|
+
export type OpenAPIParameterLocation = "query" | "header" | "path" | "cookie";
|
|
186
|
+
export type OpenAPIParameterStyle = "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject";
|
|
187
187
|
export interface OpenAPIRequestBody {
|
|
188
188
|
description?: string;
|
|
189
189
|
required?: boolean;
|
|
@@ -216,7 +216,7 @@ export interface OpenAPIResponse extends Pick<OpenAPIRequestBody, "description"
|
|
|
216
216
|
export interface OpenAPILink {
|
|
217
217
|
$ref?: string;
|
|
218
218
|
}
|
|
219
|
-
export
|
|
219
|
+
export type OpenAPIHeader = Omit<OpenAPIParameter, "in" | "name">;
|
|
220
220
|
export interface OpenAPICallback {
|
|
221
221
|
[name: string]: OpenAPIPath;
|
|
222
222
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
2
2
|
export interface OpenAPISpec {
|
|
3
3
|
openapi: string;
|
|
4
4
|
info: OpenAPIInfo;
|
|
@@ -38,7 +38,7 @@ export interface OpenAPIPaths {
|
|
|
38
38
|
export interface OpenAPIRef {
|
|
39
39
|
$ref: string;
|
|
40
40
|
}
|
|
41
|
-
export
|
|
41
|
+
export type Referenced<T> = OpenAPIRef | T;
|
|
42
42
|
export interface OpenAPIPath {
|
|
43
43
|
summary?: string;
|
|
44
44
|
description?: string;
|
|
@@ -182,8 +182,8 @@ export interface OpenAPIEncoding {
|
|
|
182
182
|
explode: boolean;
|
|
183
183
|
allowReserved: boolean;
|
|
184
184
|
}
|
|
185
|
-
export
|
|
186
|
-
export
|
|
185
|
+
export type OpenAPIParameterLocation = "query" | "header" | "path" | "cookie";
|
|
186
|
+
export type OpenAPIParameterStyle = "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject";
|
|
187
187
|
export interface OpenAPIRequestBody {
|
|
188
188
|
description?: string;
|
|
189
189
|
required?: boolean;
|
|
@@ -216,7 +216,7 @@ export interface OpenAPIResponse extends Pick<OpenAPIRequestBody, "description"
|
|
|
216
216
|
export interface OpenAPILink {
|
|
217
217
|
$ref?: string;
|
|
218
218
|
}
|
|
219
|
-
export
|
|
219
|
+
export type OpenAPIHeader = Omit<OpenAPIParameter, "in" | "name">;
|
|
220
220
|
export interface OpenAPICallback {
|
|
221
221
|
[name: string]: OpenAPIPath;
|
|
222
222
|
}
|
|
@@ -534,7 +534,7 @@ exports.setSecuritySchemePrefix = setSecuritySchemePrefix;
|
|
|
534
534
|
const shortenHTTPVerb = (verb) => ({
|
|
535
535
|
delete: "del",
|
|
536
536
|
options: "opts",
|
|
537
|
-
}[verb] || verb
|
|
537
|
+
})[verb] || verb;
|
|
538
538
|
exports.shortenHTTPVerb = shortenHTTPVerb;
|
|
539
539
|
function isRedocExtension(key) {
|
|
540
540
|
const redocExtensions = {
|
package/lib/types.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface APIVersionOptions {
|
|
|
48
48
|
export interface LoadedContent {
|
|
49
49
|
loadedApi: ApiMetadata[];
|
|
50
50
|
}
|
|
51
|
-
export
|
|
51
|
+
export type ApiMetadata = ApiPageMetadata | InfoPageMetadata | TagPageMetadata;
|
|
52
52
|
export interface ApiMetadataBase {
|
|
53
53
|
sidebar?: string;
|
|
54
54
|
previous?: ApiNavLink;
|
|
@@ -100,7 +100,7 @@ export interface TagPageMetadata extends ApiMetadataBase {
|
|
|
100
100
|
tag: TagObject;
|
|
101
101
|
markdown?: string;
|
|
102
102
|
}
|
|
103
|
-
export
|
|
103
|
+
export type ApiInfo = InfoObject;
|
|
104
104
|
export interface ApiNavLink {
|
|
105
105
|
title: string;
|
|
106
106
|
permalink: string;
|
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": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"watch": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@docusaurus/types": "^3.0.
|
|
31
|
+
"@docusaurus/types": "^3.0.1",
|
|
32
32
|
"@types/fs-extra": "^9.0.13",
|
|
33
33
|
"@types/json-pointer": "^1.0.31",
|
|
34
34
|
"@types/json-schema": "^7.0.9",
|
|
35
35
|
"@types/lodash": "^4.14.176",
|
|
36
|
-
"@types/mustache": "^4.1.2"
|
|
36
|
+
"@types/mustache": "^4.1.2",
|
|
37
|
+
"eslint-plugin-prettier": "^5.0.1"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@apidevtools/json-schema-ref-parser": "^10.1.0",
|
|
40
|
-
"@docusaurus/plugin-content-docs": "^3.0.
|
|
41
|
-
"@docusaurus/utils": "^3.0.
|
|
42
|
-
"@docusaurus/utils-validation": "^3.0.
|
|
41
|
+
"@docusaurus/plugin-content-docs": "^3.0.1",
|
|
42
|
+
"@docusaurus/utils": "^3.0.1",
|
|
43
|
+
"@docusaurus/utils-validation": "^3.0.1",
|
|
43
44
|
"@paloaltonetworks/openapi-to-postmanv2": "3.1.0-hotfix.1",
|
|
44
45
|
"@paloaltonetworks/postman-collection": "^4.1.0",
|
|
45
46
|
"@redocly/openapi-core": "^1.0.0-beta.125",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"fs-extra": "^9.0.1",
|
|
49
50
|
"json-pointer": "^0.6.2",
|
|
50
51
|
"json-schema-merge-allof": "^0.8.1",
|
|
52
|
+
"json5": "^2.2.3",
|
|
51
53
|
"lodash": "^4.17.20",
|
|
52
54
|
"mustache": "^4.2.0",
|
|
53
55
|
"slugify": "^1.6.5",
|
|
@@ -60,5 +62,5 @@
|
|
|
60
62
|
"engines": {
|
|
61
63
|
"node": ">=14"
|
|
62
64
|
},
|
|
63
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "1207af7a96b5d5a033f87e4a94b94f9b263c1f36"
|
|
64
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import zlib from "zlib";
|
|
|
12
12
|
import type { LoadContext, Plugin } from "@docusaurus/types";
|
|
13
13
|
import { Globby, posixPath } from "@docusaurus/utils";
|
|
14
14
|
import chalk from "chalk";
|
|
15
|
+
import JSON5 from "json5";
|
|
15
16
|
import { render } from "mustache";
|
|
16
17
|
|
|
17
18
|
import { createApiPageMD, createInfoPageMD, createTagPageMD } from "./markdown";
|
|
@@ -144,21 +145,26 @@ export default function pluginOpenAPIDocs(
|
|
|
144
145
|
docPath
|
|
145
146
|
);
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
let sidebarSliceTemplate = `import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";\n\n`;
|
|
149
|
+
sidebarSliceTemplate += `const sidebar: SidebarsConfig = {{{slice}}};\n\n`;
|
|
150
|
+
sidebarSliceTemplate += `export default sidebar.apisidebar;\n`;
|
|
148
151
|
|
|
149
152
|
const view = render(sidebarSliceTemplate, {
|
|
150
|
-
slice:
|
|
153
|
+
slice: JSON5.stringify(
|
|
154
|
+
{ apisidebar: sidebarSlice },
|
|
155
|
+
{ space: 2, quote: '"' }
|
|
156
|
+
),
|
|
151
157
|
});
|
|
152
158
|
|
|
153
|
-
if (!fs.existsSync(`${outputDir}/sidebar.
|
|
159
|
+
if (!fs.existsSync(`${outputDir}/sidebar.ts`)) {
|
|
154
160
|
try {
|
|
155
|
-
fs.writeFileSync(`${outputDir}/sidebar.
|
|
161
|
+
fs.writeFileSync(`${outputDir}/sidebar.ts`, view, "utf8");
|
|
156
162
|
console.log(
|
|
157
|
-
chalk.green(`Successfully created "${outputDir}/sidebar.
|
|
163
|
+
chalk.green(`Successfully created "${outputDir}/sidebar.ts"`)
|
|
158
164
|
);
|
|
159
165
|
} catch (err) {
|
|
160
166
|
console.error(
|
|
161
|
-
chalk.red(`Failed to write "${outputDir}/sidebar.
|
|
167
|
+
chalk.red(`Failed to write "${outputDir}/sidebar.ts"`),
|
|
162
168
|
chalk.yellow(err)
|
|
163
169
|
);
|
|
164
170
|
}
|
|
@@ -261,8 +267,8 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
261
267
|
item.type === "api"
|
|
262
268
|
? apiPageGenerator(item)
|
|
263
269
|
: item.type === "info"
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
? infoPageGenerator(item)
|
|
271
|
+
: tagPageGenerator(item);
|
|
266
272
|
item.markdown = markdown;
|
|
267
273
|
if (item.type === "api") {
|
|
268
274
|
// opportunity to compress JSON
|
|
@@ -380,7 +386,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
380
386
|
cwd: path.resolve(apiDir),
|
|
381
387
|
deep: 1,
|
|
382
388
|
});
|
|
383
|
-
const sidebarFile = await Globby(["sidebar.
|
|
389
|
+
const sidebarFile = await Globby(["sidebar.ts"], {
|
|
384
390
|
cwd: path.resolve(apiDir),
|
|
385
391
|
deep: 1,
|
|
386
392
|
});
|
|
@@ -425,7 +431,11 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
425
431
|
|
|
426
432
|
const versionsJson = JSON.stringify(versionsArray, null, 2);
|
|
427
433
|
try {
|
|
428
|
-
fs.writeFileSync(
|
|
434
|
+
fs.writeFileSync(
|
|
435
|
+
`${outputDir}/versions.json`,
|
|
436
|
+
versionsJson + "\n",
|
|
437
|
+
"utf8"
|
|
438
|
+
);
|
|
429
439
|
console.log(
|
|
430
440
|
chalk.green(`Successfully created "${outputDir}/versions.json"`)
|
|
431
441
|
);
|
|
@@ -461,7 +471,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
461
471
|
cli
|
|
462
472
|
.command(`gen-api-docs`)
|
|
463
473
|
.description(
|
|
464
|
-
`Generates OpenAPI docs in MDX file format and sidebar.
|
|
474
|
+
`Generates OpenAPI docs in MDX file format and sidebar.ts (if enabled).`
|
|
465
475
|
)
|
|
466
476
|
.usage("<id>")
|
|
467
477
|
.arguments("<id>")
|
|
@@ -519,7 +529,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
519
529
|
cli
|
|
520
530
|
.command(`gen-api-docs:version`)
|
|
521
531
|
.description(
|
|
522
|
-
`Generates versioned OpenAPI docs in MDX file format, versions.js and sidebar.
|
|
532
|
+
`Generates versioned OpenAPI docs in MDX file format, versions.js and sidebar.ts (if enabled).`
|
|
523
533
|
)
|
|
524
534
|
.usage("<id:version>")
|
|
525
535
|
.arguments("<id:version>")
|
|
@@ -610,7 +620,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
610
620
|
cli
|
|
611
621
|
.command(`clean-api-docs`)
|
|
612
622
|
.description(
|
|
613
|
-
`Clears the generated OpenAPI docs MDX files and sidebar.
|
|
623
|
+
`Clears the generated OpenAPI docs MDX files and sidebar.ts (if enabled).`
|
|
614
624
|
)
|
|
615
625
|
.usage("<id>")
|
|
616
626
|
.arguments("<id>")
|
|
@@ -661,7 +671,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|
|
661
671
|
cli
|
|
662
672
|
.command(`clean-api-docs:version`)
|
|
663
673
|
.description(
|
|
664
|
-
`Clears the versioned, generated OpenAPI docs MDX files, versions.json and sidebar.
|
|
674
|
+
`Clears the versioned, generated OpenAPI docs MDX files, versions.json and sidebar.ts (if enabled).`
|
|
665
675
|
)
|
|
666
676
|
.usage("<id:version>")
|
|
667
677
|
.arguments("<id:version>")
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { OAuthFlowObject, SecuritySchemeObject } from "../openapi/types";
|
|
9
8
|
import { createDescription } from "./createDescription";
|
|
10
9
|
import { create, guard } from "./utils";
|
|
10
|
+
import { OAuthFlowObject, SecuritySchemeObject } from "../openapi/types";
|
|
11
11
|
|
|
12
12
|
export function createAuthentication(securitySchemes: SecuritySchemeObject) {
|
|
13
13
|
if (!securitySchemes || !Object.keys(securitySchemes).length) return "";
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { ContactObject } from "../openapi/types";
|
|
9
8
|
import { create, guard } from "./utils";
|
|
9
|
+
import { ContactObject } from "../openapi/types";
|
|
10
10
|
|
|
11
11
|
export function createContactInfo(contact: ContactObject) {
|
|
12
12
|
if (!contact || !Object.keys(contact).length) return "";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { guard, Props, render } from "./utils";
|
|
8
|
+
import { clean, guard, Props, render } from "./utils";
|
|
9
9
|
|
|
10
10
|
function createAdmonition({ children }: Props) {
|
|
11
11
|
return `:::caution deprecated\n\n${render(children)}\n\n:::`;
|
|
@@ -23,7 +23,7 @@ export function createDeprecationNotice({
|
|
|
23
23
|
return guard(deprecated, () =>
|
|
24
24
|
createAdmonition({
|
|
25
25
|
children:
|
|
26
|
-
description ??
|
|
26
|
+
clean(description) ??
|
|
27
27
|
"This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
|
|
28
28
|
})
|
|
29
29
|
);
|
|
@@ -5,16 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { clean } from "./utils";
|
|
9
9
|
|
|
10
10
|
export function createDescription(description: string | undefined) {
|
|
11
|
-
|
|
12
|
-
return "";
|
|
13
|
-
}
|
|
14
|
-
return `\n\n${description
|
|
15
|
-
.replace(lessThan, "<")
|
|
16
|
-
.replace(greaterThan, ">")
|
|
17
|
-
.replace(codeFence, function (match) {
|
|
18
|
-
return match.replace(/\\>/g, ">");
|
|
19
|
-
})}\n\n`;
|
|
11
|
+
return `\n\n${clean(description)}\n\n`;
|
|
20
12
|
}
|
|
@@ -5,15 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { clean, create } from "./utils";
|
|
9
9
|
|
|
10
10
|
export function createHeading(heading: string) {
|
|
11
11
|
return [
|
|
12
12
|
create("h1", {
|
|
13
13
|
className: "openapi__heading",
|
|
14
|
-
children:
|
|
15
|
-
.replace(lessThan, "<")
|
|
16
|
-
.replace(greaterThan, ">")}`,
|
|
14
|
+
children: clean(heading),
|
|
17
15
|
}),
|
|
18
16
|
`\n\n`,
|
|
19
17
|
];
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { LicenseObject } from "../openapi/types";
|
|
9
8
|
import { create, guard } from "./utils";
|
|
9
|
+
import { LicenseObject } from "../openapi/types";
|
|
10
10
|
|
|
11
11
|
export function createLicense(license: LicenseObject) {
|
|
12
12
|
if (!license || !Object.keys(license).length) return "";
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { LogoObject } from "../openapi/types";
|
|
9
8
|
import { create, guard } from "./utils";
|
|
9
|
+
import { LogoObject } from "../openapi/types";
|
|
10
10
|
|
|
11
11
|
export function createLogo(
|
|
12
12
|
logo: LogoObject | undefined,
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { ApiItem } from "../types";
|
|
9
8
|
import { createDetails } from "./createDetails";
|
|
10
9
|
import { createDetailsSummary } from "./createDetailsSummary";
|
|
11
10
|
import { create } from "./utils";
|
|
11
|
+
import { ApiItem } from "../types";
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
14
|
parameters: ApiItem["parameters"];
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { MediaTypeObject } from "../openapi/types";
|
|
9
8
|
import { createRequestSchema } from "./createRequestSchema";
|
|
9
|
+
import { MediaTypeObject } from "../openapi/types";
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
title: string;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { MediaTypeObject } from "../openapi/types";
|
|
9
8
|
import { createDescription } from "./createDescription";
|
|
10
9
|
import { createDetails } from "./createDetails";
|
|
11
10
|
import { createDetailsSummary } from "./createDetailsSummary";
|
|
12
11
|
import { createNodes } from "./createSchema";
|
|
13
12
|
import { create, guard } from "./utils";
|
|
13
|
+
import { MediaTypeObject } from "../openapi/types";
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
16
16
|
style?: any;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { MediaTypeObject } from "../openapi/types";
|
|
9
8
|
import { createDescription } from "./createDescription";
|
|
10
9
|
import { createDetails } from "./createDetails";
|
|
11
10
|
import { createDetailsSummary } from "./createDetailsSummary";
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
createResponseExamples,
|
|
17
16
|
} from "./createStatusCodes";
|
|
18
17
|
import { create, guard } from "./utils";
|
|
18
|
+
import { MediaTypeObject } from "../openapi/types";
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
21
|
style?: any;
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import * as prettier from "prettier";
|
|
9
9
|
|
|
10
|
-
import { SchemaObject } from "../openapi/types";
|
|
11
10
|
import { createNodes } from "./createSchema";
|
|
11
|
+
import { SchemaObject } from "../openapi/types";
|
|
12
12
|
|
|
13
13
|
describe("createNodes", () => {
|
|
14
|
-
it("should create readable MODs for oneOf primitive properties", () => {
|
|
14
|
+
it("should create readable MODs for oneOf primitive properties", async () => {
|
|
15
15
|
const schema: SchemaObject = {
|
|
16
16
|
type: "object",
|
|
17
17
|
properties: {
|
|
@@ -48,8 +48,10 @@ describe("createNodes", () => {
|
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
50
|
expect(
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
await Promise.all(
|
|
52
|
+
createNodes(schema, "request").map(
|
|
53
|
+
async (md: any) => await prettier.format(md, { parser: "babel" })
|
|
54
|
+
)
|
|
53
55
|
)
|
|
54
56
|
).toMatchSnapshot();
|
|
55
57
|
});
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
import clsx from "clsx";
|
|
9
9
|
|
|
10
|
-
import { SchemaObject } from "../openapi/types";
|
|
11
10
|
import {
|
|
12
11
|
createClosingArrayBracket,
|
|
13
12
|
createOpeningArrayBracket,
|
|
@@ -17,6 +16,7 @@ import { createDetails } from "./createDetails";
|
|
|
17
16
|
import { createDetailsSummary } from "./createDetailsSummary";
|
|
18
17
|
import { getQualifierMessage, getSchemaName } from "./schema";
|
|
19
18
|
import { create, guard } from "./utils";
|
|
19
|
+
import { SchemaObject } from "../openapi/types";
|
|
20
20
|
|
|
21
21
|
const jsonSchemaMergeAllOf = require("json-schema-merge-allof");
|
|
22
22
|
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
import format from "xml-formatter";
|
|
9
9
|
|
|
10
|
-
import { sampleResponseFromSchema } from "../openapi/createResponseExample";
|
|
11
|
-
import { ApiItem } from "../types";
|
|
12
10
|
import { createDescription } from "./createDescription";
|
|
13
11
|
import { createDetails } from "./createDetails";
|
|
14
12
|
import { createDetailsSummary } from "./createDetailsSummary";
|
|
15
13
|
import { createResponseSchema } from "./createResponseSchema";
|
|
16
14
|
import { create } from "./utils";
|
|
17
15
|
import { guard } from "./utils";
|
|
16
|
+
import { sampleResponseFromSchema } from "../openapi/createResponseExample";
|
|
17
|
+
import { ApiItem } from "../types";
|
|
18
18
|
|
|
19
19
|
export default function json2xml(o: any, tab: any) {
|
|
20
20
|
var toXml = function (v: any, name: string, ind: any) {
|
package/src/markdown/index.ts
CHANGED
|
@@ -5,13 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
ContactObject,
|
|
10
|
-
LicenseObject,
|
|
11
|
-
MediaTypeObject,
|
|
12
|
-
SecuritySchemeObject,
|
|
13
|
-
} from "../openapi/types";
|
|
14
|
-
import { ApiPageMetadata, InfoPageMetadata, TagPageMetadata } from "../types";
|
|
15
8
|
import { createAuthentication } from "./createAuthentication";
|
|
16
9
|
import { createAuthorization } from "./createAuthorization";
|
|
17
10
|
import { createContactInfo } from "./createContactInfo";
|
|
@@ -29,7 +22,14 @@ import { createStatusCodes } from "./createStatusCodes";
|
|
|
29
22
|
import { createTermsOfService } from "./createTermsOfService";
|
|
30
23
|
import { createVendorExtensions } from "./createVendorExtensions";
|
|
31
24
|
import { createVersionBadge } from "./createVersionBadge";
|
|
32
|
-
import {
|
|
25
|
+
import { render } from "./utils";
|
|
26
|
+
import {
|
|
27
|
+
ContactObject,
|
|
28
|
+
LicenseObject,
|
|
29
|
+
MediaTypeObject,
|
|
30
|
+
SecuritySchemeObject,
|
|
31
|
+
} from "../openapi/types";
|
|
32
|
+
import { ApiPageMetadata, InfoPageMetadata, TagPageMetadata } from "../types";
|
|
33
33
|
|
|
34
34
|
interface Props {
|
|
35
35
|
title: string;
|
|
@@ -69,7 +69,7 @@ export function createApiPageMD({
|
|
|
69
69
|
`import SchemaItem from "@theme/SchemaItem";\n`,
|
|
70
70
|
`import SchemaTabs from "@theme/SchemaTabs";\n`,
|
|
71
71
|
`import TabItem from "@theme/TabItem";\n\n`,
|
|
72
|
-
createHeading(title
|
|
72
|
+
createHeading(title),
|
|
73
73
|
createMethodEndpoint(method, path),
|
|
74
74
|
infoPath && createAuthorization(infoPath),
|
|
75
75
|
frontMatter.show_extensions && createVendorExtensions(extensions),
|
|
@@ -110,7 +110,7 @@ export function createInfoPageMD({
|
|
|
110
110
|
|
|
111
111
|
createVersionBadge(version),
|
|
112
112
|
createDownload(downloadUrl),
|
|
113
|
-
createHeading(title
|
|
113
|
+
createHeading(title),
|
|
114
114
|
createLogo(logo, darkLogo),
|
|
115
115
|
createDescription(description),
|
|
116
116
|
createAuthentication(securitySchemes as unknown as SecuritySchemeObject),
|
package/src/markdown/utils.ts
CHANGED
|
@@ -50,3 +50,25 @@ export const lessThan =
|
|
|
50
50
|
export const greaterThan =
|
|
51
51
|
/(?<!(button|code|details|summary|hr|br|span|strong|small|table|thead|tbody|td|tr|th|h1|h2|h3|h4|h5|h6|title|p|em|b|i|u|strike|bold|a|li|ol|ul|img|svg|div|center|\/|\s|"|'))>/gu;
|
|
52
52
|
export const codeFence = /`{1,3}[\s\S]*?`{1,3}/g;
|
|
53
|
+
export const curlyBrackets = /([{|}])/g;
|
|
54
|
+
export const codeBlock = /(^```.*[\s\S]*?```$|`[^`].+?`)/gm;
|
|
55
|
+
|
|
56
|
+
export function clean(value: string | undefined): string {
|
|
57
|
+
if (!value) {
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let sections = value.split(codeBlock);
|
|
62
|
+
for (let sectionIndex in sections) {
|
|
63
|
+
if (!sections[sectionIndex].startsWith("`")) {
|
|
64
|
+
sections[sectionIndex] = sections[sectionIndex]
|
|
65
|
+
.replace(lessThan, "<")
|
|
66
|
+
.replace(greaterThan, ">")
|
|
67
|
+
.replace(codeFence, function (match) {
|
|
68
|
+
return match.replace(/\\>/g, ">");
|
|
69
|
+
})
|
|
70
|
+
.replace(curlyBrackets, "\\$1");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return sections.join("");
|
|
74
|
+
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import merge from "lodash/merge";
|
|
10
10
|
|
|
11
|
-
import { mergeAllOf } from "../markdown/createSchema";
|
|
12
11
|
import { SchemaObject } from "./types";
|
|
12
|
+
import { mergeAllOf } from "../markdown/createSchema";
|
|
13
13
|
|
|
14
14
|
interface OASTypeToTypeMap {
|
|
15
15
|
string: string;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import merge from "lodash/merge";
|
|
10
10
|
|
|
11
|
-
import { mergeAllOf } from "../markdown/createSchema";
|
|
12
11
|
import { SchemaObject } from "./types";
|
|
12
|
+
import { mergeAllOf } from "../markdown/createSchema";
|
|
13
13
|
|
|
14
14
|
interface OASTypeToTypeMap {
|
|
15
15
|
string: string;
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -18,6 +18,9 @@ import kebabCase from "lodash/kebabCase";
|
|
|
18
18
|
import unionBy from "lodash/unionBy";
|
|
19
19
|
import uniq from "lodash/uniq";
|
|
20
20
|
|
|
21
|
+
import { sampleRequestFromSchema } from "./createRequestExample";
|
|
22
|
+
import { OpenApiObject, TagObject } from "./types";
|
|
23
|
+
import { loadAndResolveSpec } from "./utils/loadAndResolveSpec";
|
|
21
24
|
import { isURL } from "../index";
|
|
22
25
|
import {
|
|
23
26
|
ApiMetadata,
|
|
@@ -27,9 +30,6 @@ import {
|
|
|
27
30
|
SidebarOptions,
|
|
28
31
|
TagPageMetadata,
|
|
29
32
|
} from "../types";
|
|
30
|
-
import { sampleRequestFromSchema } from "./createRequestExample";
|
|
31
|
-
import { OpenApiObject, TagObject } from "./types";
|
|
32
|
-
import { loadAndResolveSpec } from "./utils/loadAndResolveSpec";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Convenience function for converting raw JSON to a Postman Collection object.
|
|
@@ -13,8 +13,8 @@ import chalk from "chalk";
|
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
import { convertObj } from "swagger2openapi";
|
|
15
15
|
|
|
16
|
-
import { OpenApiObject } from "../types";
|
|
17
16
|
import { OpenAPIParser } from "./services/OpenAPIParser";
|
|
17
|
+
import { OpenApiObject } from "../types";
|
|
18
18
|
|
|
19
19
|
function serializer(replacer: any, cycleReplacer: any) {
|
|
20
20
|
var stack: any = [],
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
|
|
10
|
+
import { RedocNormalizedOptions } from "./RedocNormalizedOptions";
|
|
10
11
|
import { OpenAPIRef, OpenAPISchema, OpenAPISpec, Referenced } from "../types";
|
|
11
12
|
import { isArray, isBoolean } from "../utils/helpers";
|
|
12
13
|
import { JsonPointer } from "../utils/JsonPointer";
|
|
13
14
|
import { getDefinitionName, isNamedDefinition } from "../utils/openapi";
|
|
14
|
-
import { RedocNormalizedOptions } from "./RedocNormalizedOptions";
|
|
15
15
|
|
|
16
16
|
export type MergedOpenAPISchema = OpenAPISchema & { parentRefs?: string[] };
|
|
17
17
|
|
|
@@ -326,8 +326,8 @@ export class OpenAPIParser {
|
|
|
326
326
|
const receiverItems = isBoolean(receiver.items)
|
|
327
327
|
? { items: receiver.items }
|
|
328
328
|
: receiver.items
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
? (Object.assign({}, receiver.items) as OpenAPISchema)
|
|
330
|
+
: {};
|
|
331
331
|
const subSchemaItems = isBoolean(items)
|
|
332
332
|
? { items }
|
|
333
333
|
: (Object.assign({}, items) as OpenAPISchema);
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
import { dirname } from "path";
|
|
11
11
|
|
|
12
|
+
import {
|
|
13
|
+
isNumeric,
|
|
14
|
+
removeQueryString,
|
|
15
|
+
resolveUrl,
|
|
16
|
+
isArray,
|
|
17
|
+
isBoolean,
|
|
18
|
+
} from "./helpers";
|
|
12
19
|
import { OpenAPIParser } from "../services/OpenAPIParser";
|
|
13
20
|
import {
|
|
14
21
|
OpenAPIEncoding,
|
|
@@ -21,13 +28,6 @@ import {
|
|
|
21
28
|
OpenAPIServer,
|
|
22
29
|
Referenced,
|
|
23
30
|
} from "../types";
|
|
24
|
-
import {
|
|
25
|
-
isNumeric,
|
|
26
|
-
removeQueryString,
|
|
27
|
-
resolveUrl,
|
|
28
|
-
isArray,
|
|
29
|
-
isBoolean,
|
|
30
|
-
} from "./helpers";
|
|
31
31
|
|
|
32
32
|
function isWildcardStatusCode(
|
|
33
33
|
statusCode: string | number
|
|
@@ -689,7 +689,7 @@ export const shortenHTTPVerb = (verb) =>
|
|
|
689
689
|
({
|
|
690
690
|
delete: "del",
|
|
691
691
|
options: "opts",
|
|
692
|
-
}[verb] || verb
|
|
692
|
+
})[verb] || verb;
|
|
693
693
|
|
|
694
694
|
export function isRedocExtension(key: string): boolean {
|
|
695
695
|
const redocExtensions = {
|