docusaurus-plugin-openapi-docs 0.0.0-beta.691 → 0.0.0-beta.719
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 +2 -0
- package/lib/index.js +75 -19
- package/lib/markdown/createAuthentication.js +4 -3
- package/lib/markdown/createCallbacks.d.ts +6 -0
- package/lib/markdown/createCallbacks.js +78 -0
- package/lib/markdown/createDeprecationNotice.js +6 -3
- package/lib/markdown/createDescription.js +1 -9
- package/lib/markdown/createHeading.js +4 -5
- package/lib/markdown/createRequestBodyDetails.d.ts +1 -1
- package/lib/markdown/createRequestHeader.d.ts +1 -1
- package/lib/markdown/createRequestHeader.js +10 -1
- package/lib/markdown/createSchema.d.ts +1 -1
- package/lib/markdown/createSchema.js +23 -9
- package/lib/markdown/createSchema.test.js +2 -2
- package/lib/markdown/createStatusCodes.d.ts +3 -1
- package/lib/markdown/createStatusCodes.js +8 -6
- package/lib/markdown/createVersionBadge.js +1 -1
- package/lib/markdown/index.d.ts +3 -2
- package/lib/markdown/index.js +31 -6
- package/lib/markdown/schema.js +3 -0
- package/lib/markdown/utils.d.ts +9 -3
- package/lib/markdown/utils.js +29 -4
- package/lib/openapi/openapi.d.ts +3 -3
- package/lib/openapi/openapi.js +60 -7
- package/lib/openapi/openapi.test.js +2 -0
- package/lib/openapi/types.d.ts +18 -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/options.js +2 -1
- package/lib/sidebars/index.d.ts +2 -2
- package/lib/sidebars/index.js +49 -9
- package/lib/types.d.ts +16 -3
- package/package.json +11 -9
- package/src/index.ts +134 -21
- package/src/markdown/__snapshots__/createSchema.test.ts.snap +4 -28
- package/src/markdown/createAuthentication.ts +11 -6
- package/src/markdown/createCallbacks.ts +101 -0
- 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 +10 -7
- 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 +2 -2
- package/src/markdown/createRequestHeader.ts +15 -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 +32 -19
- package/src/markdown/createStatusCodes.ts +11 -7
- package/src/markdown/createVersionBadge.ts +8 -4
- package/src/markdown/index.ts +45 -14
- package/src/markdown/schema.ts +4 -0
- package/src/markdown/utils.ts +37 -4
- package/src/openapi/__fixtures__/examples/openapi.yaml +29 -0
- package/src/openapi/createRequestExample.ts +1 -1
- package/src/openapi/createResponseExample.ts +1 -1
- package/src/openapi/openapi.test.ts +3 -0
- package/src/openapi/openapi.ts +77 -9
- package/src/openapi/types.ts +6 -0
- 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/options.ts +2 -1
- package/src/sidebars/index.ts +70 -15
- package/src/types.ts +21 -1
package/lib/markdown/index.js
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.createTagPageMD = exports.createInfoPageMD = exports.createApiPageMD = void 0;
|
|
9
|
+
exports.createSchemaPageMD = exports.createTagPageMD = exports.createInfoPageMD = exports.createApiPageMD = void 0;
|
|
10
10
|
const createAuthentication_1 = require("./createAuthentication");
|
|
11
11
|
const createAuthorization_1 = require("./createAuthorization");
|
|
12
|
+
const createCallbacks_1 = require("./createCallbacks");
|
|
12
13
|
const createContactInfo_1 = require("./createContactInfo");
|
|
13
14
|
const createDeprecationNotice_1 = require("./createDeprecationNotice");
|
|
14
15
|
const createDescription_1 = require("./createDescription");
|
|
@@ -20,12 +21,13 @@ const createMethodEndpoint_1 = require("./createMethodEndpoint");
|
|
|
20
21
|
const createParamsDetails_1 = require("./createParamsDetails");
|
|
21
22
|
const createRequestBodyDetails_1 = require("./createRequestBodyDetails");
|
|
22
23
|
const createRequestHeader_1 = require("./createRequestHeader");
|
|
24
|
+
const createSchema_1 = require("./createSchema");
|
|
23
25
|
const createStatusCodes_1 = require("./createStatusCodes");
|
|
24
26
|
const createTermsOfService_1 = require("./createTermsOfService");
|
|
25
27
|
const createVendorExtensions_1 = require("./createVendorExtensions");
|
|
26
28
|
const createVersionBadge_1 = require("./createVersionBadge");
|
|
27
29
|
const utils_1 = require("./utils");
|
|
28
|
-
function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, method, path, extensions, parameters, requestBody, responses, }, infoPath, frontMatter, }) {
|
|
30
|
+
function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, method, path, extensions, parameters, requestBody, responses, callbacks, }, infoPath, frontMatter, }) {
|
|
29
31
|
return (0, utils_1.render)([
|
|
30
32
|
`import ApiTabs from "@theme/ApiTabs";\n`,
|
|
31
33
|
`import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
|
|
@@ -36,14 +38,19 @@ function createApiPageMD({ title, api: { deprecated, "x-deprecated-description":
|
|
|
36
38
|
`import ResponseSamples from "@theme/ResponseSamples";\n`,
|
|
37
39
|
`import SchemaItem from "@theme/SchemaItem";\n`,
|
|
38
40
|
`import SchemaTabs from "@theme/SchemaTabs";\n`,
|
|
41
|
+
`import Markdown from "@theme/Markdown";\n`,
|
|
42
|
+
`import Heading from "@theme/Heading";\n`,
|
|
43
|
+
`import OperationTabs from "@theme/OperationTabs";\n`,
|
|
39
44
|
`import TabItem from "@theme/TabItem";\n\n`,
|
|
40
|
-
(0, createHeading_1.createHeading)(title
|
|
45
|
+
(0, createHeading_1.createHeading)(title),
|
|
41
46
|
(0, createMethodEndpoint_1.createMethodEndpoint)(method, path),
|
|
42
47
|
infoPath && (0, createAuthorization_1.createAuthorization)(infoPath),
|
|
43
|
-
frontMatter.show_extensions
|
|
48
|
+
frontMatter.show_extensions
|
|
49
|
+
? (0, createVendorExtensions_1.createVendorExtensions)(extensions)
|
|
50
|
+
: undefined,
|
|
44
51
|
(0, createDeprecationNotice_1.createDeprecationNotice)({ deprecated, description: deprecatedDescription }),
|
|
45
52
|
(0, createDescription_1.createDescription)(description),
|
|
46
|
-
(0, createRequestHeader_1.createRequestHeader)("Request"),
|
|
53
|
+
requestBody || parameters ? (0, createRequestHeader_1.createRequestHeader)("Request") : undefined,
|
|
47
54
|
(0, createParamsDetails_1.createParamsDetails)({ parameters, type: "path" }),
|
|
48
55
|
(0, createParamsDetails_1.createParamsDetails)({ parameters, type: "query" }),
|
|
49
56
|
(0, createParamsDetails_1.createParamsDetails)({ parameters, type: "header" }),
|
|
@@ -53,18 +60,20 @@ function createApiPageMD({ title, api: { deprecated, "x-deprecated-description":
|
|
|
53
60
|
body: requestBody,
|
|
54
61
|
}),
|
|
55
62
|
(0, createStatusCodes_1.createStatusCodes)({ responses }),
|
|
63
|
+
(0, createCallbacks_1.createCallbacks)({ callbacks }),
|
|
56
64
|
]);
|
|
57
65
|
}
|
|
58
66
|
exports.createApiPageMD = createApiPageMD;
|
|
59
67
|
function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService, logo, darkLogo, }, securitySchemes, downloadUrl, }) {
|
|
60
68
|
return (0, utils_1.render)([
|
|
61
69
|
`import ApiLogo from "@theme/ApiLogo";\n`,
|
|
70
|
+
`import Heading from "@theme/Heading";\n`,
|
|
62
71
|
`import SchemaTabs from "@theme/SchemaTabs";\n`,
|
|
63
72
|
`import TabItem from "@theme/TabItem";\n`,
|
|
64
73
|
`import Export from "@theme/ApiExplorer/Export";\n\n`,
|
|
65
74
|
(0, createVersionBadge_1.createVersionBadge)(version),
|
|
66
75
|
(0, createDownload_1.createDownload)(downloadUrl),
|
|
67
|
-
(0, createHeading_1.createHeading)(title
|
|
76
|
+
(0, createHeading_1.createHeading)(title),
|
|
68
77
|
(0, createLogo_1.createLogo)(logo, darkLogo),
|
|
69
78
|
(0, createDescription_1.createDescription)(description),
|
|
70
79
|
(0, createAuthentication_1.createAuthentication)(securitySchemes),
|
|
@@ -78,3 +87,19 @@ function createTagPageMD({ tag: { description } }) {
|
|
|
78
87
|
return (0, utils_1.render)([(0, createDescription_1.createDescription)(description)]);
|
|
79
88
|
}
|
|
80
89
|
exports.createTagPageMD = createTagPageMD;
|
|
90
|
+
function createSchemaPageMD({ schema }) {
|
|
91
|
+
const { title = "", description } = schema;
|
|
92
|
+
return (0, utils_1.render)([
|
|
93
|
+
`import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
|
|
94
|
+
`import SchemaItem from "@theme/SchemaItem";\n`,
|
|
95
|
+
`import SchemaTabs from "@theme/SchemaTabs";\n`,
|
|
96
|
+
`import Heading from "@theme/Heading";\n`,
|
|
97
|
+
`import TabItem from "@theme/TabItem";\n\n`,
|
|
98
|
+
(0, createHeading_1.createHeading)(title.replace(utils_1.lessThan, "<").replace(utils_1.greaterThan, ">")),
|
|
99
|
+
(0, createDescription_1.createDescription)(description),
|
|
100
|
+
(0, utils_1.create)("ul", {
|
|
101
|
+
children: (0, createSchema_1.createNodes)(schema, "response"),
|
|
102
|
+
}),
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
exports.createSchemaPageMD = createSchemaPageMD;
|
package/lib/markdown/schema.js
CHANGED
|
@@ -35,6 +35,9 @@ function prettyName(schema, circular) {
|
|
|
35
35
|
return (_d = (_c = schema.xml) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : schema.type;
|
|
36
36
|
// return schema.type;
|
|
37
37
|
}
|
|
38
|
+
if (schema.title && schema.type) {
|
|
39
|
+
return `${schema.title} (${schema.type})`;
|
|
40
|
+
}
|
|
38
41
|
return (_e = schema.title) !== null && _e !== void 0 ? _e : schema.type;
|
|
39
42
|
}
|
|
40
43
|
function getSchemaName(schema, circular) {
|
package/lib/markdown/utils.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
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
|
-
export
|
|
5
|
+
export type Options = {
|
|
6
|
+
inline?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function create(tag: string, props: Props, options?: Options): string;
|
|
6
9
|
export declare function guard<T>(value: T | undefined, cb: (value: T) => Children): string;
|
|
7
10
|
export declare function render(children: Children): string;
|
|
8
11
|
export declare const lessThan: RegExp;
|
|
9
12
|
export declare const greaterThan: RegExp;
|
|
10
13
|
export declare const codeFence: RegExp;
|
|
14
|
+
export declare const curlyBrackets: RegExp;
|
|
15
|
+
export declare const codeBlock: RegExp;
|
|
16
|
+
export declare function clean(value: string | undefined): string;
|
package/lib/markdown/utils.js
CHANGED
|
@@ -6,21 +6,25 @@
|
|
|
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;
|
|
10
|
-
function create(tag, props) {
|
|
9
|
+
exports.clean = exports.codeBlock = exports.curlyBrackets = exports.codeFence = exports.greaterThan = exports.lessThan = exports.render = exports.guard = exports.create = void 0;
|
|
10
|
+
function create(tag, props, options = {}) {
|
|
11
11
|
const { children, ...rest } = props;
|
|
12
12
|
let propString = "";
|
|
13
13
|
for (const [key, value] of Object.entries(rest)) {
|
|
14
14
|
propString += `\n ${key}={${JSON.stringify(value)}}`;
|
|
15
15
|
}
|
|
16
|
-
propString += propString ? "\n" : "";
|
|
17
16
|
let indentedChildren = render(children).replace(/^/gm, " ");
|
|
17
|
+
if (options.inline) {
|
|
18
|
+
propString += `\n children={${JSON.stringify(children)}}`;
|
|
19
|
+
indentedChildren = "";
|
|
20
|
+
}
|
|
21
|
+
propString += propString ? "\n" : "";
|
|
18
22
|
indentedChildren += indentedChildren ? "\n" : "";
|
|
19
23
|
return `<${tag}${propString}>\n${indentedChildren}</${tag}>`;
|
|
20
24
|
}
|
|
21
25
|
exports.create = create;
|
|
22
26
|
function guard(value, cb) {
|
|
23
|
-
if (!!value) {
|
|
27
|
+
if (!!value || value === 0) {
|
|
24
28
|
const children = cb(value);
|
|
25
29
|
return render(children);
|
|
26
30
|
}
|
|
@@ -41,3 +45,24 @@ exports.render = render;
|
|
|
41
45
|
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
46
|
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
47
|
exports.codeFence = /`{1,3}[\s\S]*?`{1,3}/g;
|
|
48
|
+
exports.curlyBrackets = /([{|}])/g;
|
|
49
|
+
exports.codeBlock = /(^```.*[\s\S]*?```$|`[^`].+?`)/gm;
|
|
50
|
+
function clean(value) {
|
|
51
|
+
if (!value) {
|
|
52
|
+
return "";
|
|
53
|
+
}
|
|
54
|
+
let sections = value.split(exports.codeBlock);
|
|
55
|
+
for (let sectionIndex in sections) {
|
|
56
|
+
if (!sections[sectionIndex].startsWith("`")) {
|
|
57
|
+
sections[sectionIndex] = sections[sectionIndex]
|
|
58
|
+
.replace(exports.lessThan, "<")
|
|
59
|
+
.replace(exports.greaterThan, ">")
|
|
60
|
+
.replace(exports.codeFence, function (match) {
|
|
61
|
+
return match.replace(/\\>/g, ">");
|
|
62
|
+
})
|
|
63
|
+
.replace(exports.curlyBrackets, "\\$1");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return sections.join("");
|
|
67
|
+
}
|
|
68
|
+
exports.clean = clean;
|
package/lib/openapi/openapi.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { OpenApiObject, TagGroupObject, TagObject } from "./types";
|
|
1
2
|
import { ApiMetadata, APIOptions, SidebarOptions } from "../types";
|
|
2
|
-
import { OpenApiObject, TagObject } from "./types";
|
|
3
3
|
interface OpenApiFiles {
|
|
4
4
|
source: string;
|
|
5
5
|
sourceDirName: string;
|
|
6
6
|
data: OpenApiObject;
|
|
7
7
|
}
|
|
8
8
|
export declare function readOpenapiFiles(openapiPath: string): Promise<OpenApiFiles[]>;
|
|
9
|
-
export declare function processOpenapiFiles(files: OpenApiFiles[], options: APIOptions, sidebarOptions: SidebarOptions): Promise<[ApiMetadata[], TagObject[][]]>;
|
|
10
|
-
export declare function processOpenapiFile(openapiData: OpenApiObject, options: APIOptions, sidebarOptions: SidebarOptions): Promise<[ApiMetadata[], TagObject[]]>;
|
|
9
|
+
export declare function processOpenapiFiles(files: OpenApiFiles[], options: APIOptions, sidebarOptions: SidebarOptions): Promise<[ApiMetadata[], TagObject[][], TagGroupObject[]]>;
|
|
10
|
+
export declare function processOpenapiFile(openapiData: OpenApiObject, options: APIOptions, sidebarOptions: SidebarOptions): Promise<[ApiMetadata[], TagObject[], TagGroupObject[]]>;
|
|
11
11
|
export declare function getTagDisplayName(tagName: string, tags: TagObject[]): string;
|
|
12
12
|
export {};
|
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
|
*/
|
|
@@ -61,7 +61,7 @@ async function createPostmanCollection(openapiData) {
|
|
|
61
61
|
return await jsonToCollection(data);
|
|
62
62
|
}
|
|
63
63
|
function createItems(openapiData, options, sidebarOptions) {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
65
65
|
// TODO: Find a better way to handle this
|
|
66
66
|
let items = [];
|
|
67
67
|
const infoIdSpaces = openapiData.info.title.replace(" ", "-").toLowerCase();
|
|
@@ -324,9 +324,42 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
324
324
|
items.push(apiPage);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
+
if ((options === null || options === void 0 ? void 0 : options.showSchemas) === true) {
|
|
328
|
+
// Gather schemas
|
|
329
|
+
for (let [schema, schemaObject] of Object.entries((_1 = (_0 = openapiData === null || openapiData === void 0 ? void 0 : openapiData.components) === null || _0 === void 0 ? void 0 : _0.schemas) !== null && _1 !== void 0 ? _1 : {})) {
|
|
330
|
+
const baseIdSpaces = (_3 = (_2 = schemaObject === null || schemaObject === void 0 ? void 0 : schemaObject.title) === null || _2 === void 0 ? void 0 : _2.replace(" ", "-").toLowerCase()) !== null && _3 !== void 0 ? _3 : "";
|
|
331
|
+
const baseId = (0, kebabCase_1.default)(baseIdSpaces);
|
|
332
|
+
const schemaDescription = schemaObject.description;
|
|
333
|
+
let splitDescription;
|
|
334
|
+
if (schemaDescription) {
|
|
335
|
+
splitDescription = schemaDescription.match(/[^\r\n]+/g);
|
|
336
|
+
}
|
|
337
|
+
const schemaPage = {
|
|
338
|
+
type: "schema",
|
|
339
|
+
id: baseId,
|
|
340
|
+
infoId: infoId !== null && infoId !== void 0 ? infoId : "",
|
|
341
|
+
unversionedId: baseId,
|
|
342
|
+
title: schemaObject.title
|
|
343
|
+
? schemaObject.title.replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
|
|
344
|
+
: schema,
|
|
345
|
+
description: schemaObject.description
|
|
346
|
+
? schemaObject.description.replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
|
|
347
|
+
: "",
|
|
348
|
+
frontMatter: {
|
|
349
|
+
description: splitDescription
|
|
350
|
+
? splitDescription[0]
|
|
351
|
+
.replace(/((?:^|[^\\])(?:\\{2})*)"/g, "$1'")
|
|
352
|
+
.replace(/\s+$/, "")
|
|
353
|
+
: "",
|
|
354
|
+
},
|
|
355
|
+
schema: schemaObject,
|
|
356
|
+
};
|
|
357
|
+
items.push(schemaPage);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
327
360
|
if ((sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.categoryLinkSource) === "tag") {
|
|
328
361
|
// Get global tags
|
|
329
|
-
const tags = (
|
|
362
|
+
const tags = (_4 = openapiData.tags) !== null && _4 !== void 0 ? _4 : [];
|
|
330
363
|
// Get operation tags
|
|
331
364
|
const apiItems = items.filter((item) => {
|
|
332
365
|
return item.type === "api";
|
|
@@ -375,7 +408,9 @@ function bindCollectionToApiItems(items, postmanCollection) {
|
|
|
375
408
|
.getPath({ unresolved: true }) // unresolved returns "/:variableName" instead of "/<type>"
|
|
376
409
|
.replace(/(?<![a-z0-9-_]+):([a-z0-9-_]+)/gi, "{$1}"); // replace "/:variableName" with "/{variableName}"
|
|
377
410
|
const apiItem = items.find((item) => {
|
|
378
|
-
if (item.type === "info" ||
|
|
411
|
+
if (item.type === "info" ||
|
|
412
|
+
item.type === "tag" ||
|
|
413
|
+
item.type === "schema") {
|
|
379
414
|
return false;
|
|
380
415
|
}
|
|
381
416
|
return item.api.path === path && item.api.method === method;
|
|
@@ -426,7 +461,8 @@ async function processOpenapiFiles(files, options, sidebarOptions) {
|
|
|
426
461
|
...item,
|
|
427
462
|
}));
|
|
428
463
|
const tags = processedFile[1];
|
|
429
|
-
|
|
464
|
+
const tagGroups = processedFile[2];
|
|
465
|
+
return [itemsObjectsArray, tags, tagGroups];
|
|
430
466
|
}
|
|
431
467
|
console.warn(chalk_1.default.yellow(`WARNING: the following OpenAPI spec returned undefined: ${file.source}`));
|
|
432
468
|
return [];
|
|
@@ -449,7 +485,20 @@ async function processOpenapiFiles(files, options, sidebarOptions) {
|
|
|
449
485
|
// Remove undefined tags due to transient parsing errors
|
|
450
486
|
return x !== undefined;
|
|
451
487
|
});
|
|
452
|
-
|
|
488
|
+
const tagGroups = metadata
|
|
489
|
+
.map(function (x) {
|
|
490
|
+
return x[2];
|
|
491
|
+
})
|
|
492
|
+
.flat()
|
|
493
|
+
.filter(function (x) {
|
|
494
|
+
// Remove undefined tags due to transient parsing errors
|
|
495
|
+
return x !== undefined;
|
|
496
|
+
});
|
|
497
|
+
return [
|
|
498
|
+
items,
|
|
499
|
+
tags,
|
|
500
|
+
tagGroups,
|
|
501
|
+
];
|
|
453
502
|
}
|
|
454
503
|
exports.processOpenapiFiles = processOpenapiFiles;
|
|
455
504
|
async function processOpenapiFile(openapiData, options, sidebarOptions) {
|
|
@@ -460,7 +509,11 @@ async function processOpenapiFile(openapiData, options, sidebarOptions) {
|
|
|
460
509
|
if (openapiData.tags !== undefined) {
|
|
461
510
|
tags = openapiData.tags;
|
|
462
511
|
}
|
|
463
|
-
|
|
512
|
+
let tagGroups = [];
|
|
513
|
+
if (openapiData["x-tagGroups"] !== undefined) {
|
|
514
|
+
tagGroups = openapiData["x-tagGroups"];
|
|
515
|
+
}
|
|
516
|
+
return [items, tags, tagGroups];
|
|
464
517
|
}
|
|
465
518
|
exports.processOpenapiFile = processOpenapiFile;
|
|
466
519
|
// order for picking items as a display name of tags
|
|
@@ -24,6 +24,8 @@ describe("openapi", () => {
|
|
|
24
24
|
const yaml = results.find((x) => x.source.endsWith("openapi.yaml"));
|
|
25
25
|
expect(yaml).toBeTruthy();
|
|
26
26
|
expect(yaml === null || yaml === void 0 ? void 0 : yaml.sourceDirName).toBe(".");
|
|
27
|
+
expect(yaml === null || yaml === void 0 ? void 0 : yaml.data.tags).toBeDefined();
|
|
28
|
+
expect(yaml === null || yaml === void 0 ? void 0 : yaml.data["x-tagGroups"]).toBeDefined();
|
|
27
29
|
});
|
|
28
30
|
});
|
|
29
31
|
});
|
package/lib/openapi/types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface OpenApiObject {
|
|
|
13
13
|
externalDocs?: ExternalDocumentationObject;
|
|
14
14
|
swagger?: string;
|
|
15
15
|
"x-webhooks"?: PathsObject;
|
|
16
|
+
"x-tagGroups"?: TagGroupObject[];
|
|
16
17
|
}
|
|
17
18
|
export interface OpenApiObjectWithRef {
|
|
18
19
|
openapi: string;
|
|
@@ -81,8 +82,8 @@ export interface ComponentsObjectWithRef {
|
|
|
81
82
|
links?: Map<LinkObject | ReferenceObject>;
|
|
82
83
|
callbacks?: Map<CallbackObjectWithRef | ReferenceObject>;
|
|
83
84
|
}
|
|
84
|
-
export
|
|
85
|
-
export
|
|
85
|
+
export type PathsObject = Map<PathItemObject>;
|
|
86
|
+
export type PathsObjectWithRef = Map<PathItemObjectWithRef>;
|
|
86
87
|
export interface PathItemObject {
|
|
87
88
|
$ref?: string;
|
|
88
89
|
summary?: string;
|
|
@@ -214,8 +215,8 @@ export interface EncodingObjectWithRef {
|
|
|
214
215
|
explode?: boolean;
|
|
215
216
|
allowReserved?: boolean;
|
|
216
217
|
}
|
|
217
|
-
export
|
|
218
|
-
export
|
|
218
|
+
export type ResponsesObject = Map<ResponseObject>;
|
|
219
|
+
export type ResponsesObjectWithRef = Map<ResponseObjectWithRef | ReferenceObject>;
|
|
219
220
|
export interface ResponseObject {
|
|
220
221
|
description: string;
|
|
221
222
|
headers?: Map<HeaderObject>;
|
|
@@ -228,8 +229,8 @@ export interface ResponseObjectWithRef {
|
|
|
228
229
|
content?: Map<MediaTypeObjectWithRef>;
|
|
229
230
|
links?: Map<LinkObject | ReferenceObject>;
|
|
230
231
|
}
|
|
231
|
-
export
|
|
232
|
-
export
|
|
232
|
+
export type CallbackObject = Map<PathItemObject>;
|
|
233
|
+
export type CallbackObjectWithRef = Map<PathItemObjectWithRef>;
|
|
233
234
|
export interface ExampleObject {
|
|
234
235
|
summary?: string;
|
|
235
236
|
description?: string;
|
|
@@ -244,19 +245,23 @@ export interface LinkObject {
|
|
|
244
245
|
description?: string;
|
|
245
246
|
server?: ServerObject;
|
|
246
247
|
}
|
|
247
|
-
export
|
|
248
|
-
export
|
|
248
|
+
export type HeaderObject = Omit<ParameterObject, "name" | "in">;
|
|
249
|
+
export type HeaderObjectWithRef = Omit<ParameterObjectWithRef, "name" | "in">;
|
|
249
250
|
export interface TagObject {
|
|
250
251
|
name?: string;
|
|
251
252
|
description?: string;
|
|
252
253
|
externalDocs?: ExternalDocumentationObject;
|
|
253
254
|
"x-displayName"?: string;
|
|
254
255
|
}
|
|
256
|
+
export interface TagGroupObject {
|
|
257
|
+
name: string;
|
|
258
|
+
tags: string[];
|
|
259
|
+
}
|
|
255
260
|
export interface ReferenceObject {
|
|
256
261
|
$ref: string;
|
|
257
262
|
}
|
|
258
|
-
export
|
|
259
|
-
export
|
|
263
|
+
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
264
|
+
export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
260
265
|
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
261
266
|
allOf?: SchemaObject[];
|
|
262
267
|
oneOf?: SchemaObject[];
|
|
@@ -274,7 +279,7 @@ export declare type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" |
|
|
|
274
279
|
example?: any;
|
|
275
280
|
deprecated?: boolean;
|
|
276
281
|
};
|
|
277
|
-
export
|
|
282
|
+
export type SchemaObjectWithRef = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
278
283
|
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
279
284
|
allOf?: (SchemaObject | ReferenceObject)[];
|
|
280
285
|
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
@@ -303,7 +308,7 @@ export interface XMLObject {
|
|
|
303
308
|
attribute?: boolean;
|
|
304
309
|
wrapped?: boolean;
|
|
305
310
|
}
|
|
306
|
-
export
|
|
311
|
+
export type SecuritySchemeObject = ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject;
|
|
307
312
|
export interface ApiKeySecuritySchemeObject {
|
|
308
313
|
type: "apiKey";
|
|
309
314
|
description?: string;
|
|
@@ -340,5 +345,5 @@ export interface OAuthFlowObject {
|
|
|
340
345
|
refreshUrl?: string;
|
|
341
346
|
scopes: Map<string>;
|
|
342
347
|
}
|
|
343
|
-
export
|
|
348
|
+
export type SecurityRequirementObject = Map<string[]>;
|
|
344
349
|
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/options.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.OptionsSchema = void 0;
|
|
10
10
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
11
|
const sidebarOptions = utils_validation_1.Joi.object({
|
|
12
|
-
groupPathsBy: utils_validation_1.Joi.string().valid("tag"),
|
|
12
|
+
groupPathsBy: utils_validation_1.Joi.string().valid("tag", "tagGroup"),
|
|
13
13
|
categoryLinkSource: utils_validation_1.Joi.string().valid("tag", "info", "auto"),
|
|
14
14
|
customProps: utils_validation_1.Joi.object(),
|
|
15
15
|
sidebarCollapsible: utils_validation_1.Joi.boolean(),
|
|
@@ -34,6 +34,7 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
34
34
|
showExtensions: utils_validation_1.Joi.boolean(),
|
|
35
35
|
sidebarOptions: sidebarOptions,
|
|
36
36
|
markdownGenerators: markdownGenerators,
|
|
37
|
+
showSchemas: utils_validation_1.Joi.boolean(),
|
|
37
38
|
version: utils_validation_1.Joi.string().when("versions", {
|
|
38
39
|
is: utils_validation_1.Joi.exist(),
|
|
39
40
|
then: utils_validation_1.Joi.required(),
|