docusaurus-plugin-openapi-docs 0.0.0-701 → 0.0.0-703
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 +1 -1
- package/lib/markdown/createStatusCodes.js +1 -1
- package/lib/markdown/utils.d.ts +2 -2
- 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/types.d.ts +2 -2
- package/package.json +2 -2
- package/src/markdown/createAuthentication.ts +1 -1
- package/src/markdown/createCallbacks.ts +2 -2
- package/src/markdown/createContactInfo.ts +1 -1
- 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 +1 -1
- package/src/markdown/createSchema.ts +1 -1
- package/src/markdown/createStatusCodes.ts +2 -2
- package/src/markdown/index.ts +12 -12
- 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 +1 -1
- package/src/openapi/utils/utils/openapi.ts +7 -7
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Key Features:
|
|
|
31
31
|
|
|
32
32
|
| Docusaurus OpenAPI Docs | Docusaurus |
|
|
33
33
|
| ----------------------- | --------------- |
|
|
34
|
-
| 3.0.0-beta.x (beta) | `3.0.1`
|
|
34
|
+
| 3.0.0-beta.x (beta) | `3.0.1 - 3.1.1` |
|
|
35
35
|
| 2.0.x (current) | `2.4.1 - 2.4.3` |
|
|
36
36
|
| 1.7.3 (legacy) | `2.0.1 - 2.2.0` |
|
|
37
37
|
|
|
@@ -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/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;
|
package/lib/openapi/openapi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiMetadata, APIOptions, SidebarOptions } from "../types";
|
|
2
1
|
import { OpenApiObject, TagGroupObject, TagObject } from "./types";
|
|
2
|
+
import { ApiMetadata, APIOptions, SidebarOptions } from "../types";
|
|
3
3
|
interface OpenApiFiles {
|
|
4
4
|
source: string;
|
|
5
5
|
sourceDirName: string;
|
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
|
@@ -82,8 +82,8 @@ export interface ComponentsObjectWithRef {
|
|
|
82
82
|
links?: Map<LinkObject | ReferenceObject>;
|
|
83
83
|
callbacks?: Map<CallbackObjectWithRef | ReferenceObject>;
|
|
84
84
|
}
|
|
85
|
-
export
|
|
86
|
-
export
|
|
85
|
+
export type PathsObject = Map<PathItemObject>;
|
|
86
|
+
export type PathsObjectWithRef = Map<PathItemObjectWithRef>;
|
|
87
87
|
export interface PathItemObject {
|
|
88
88
|
$ref?: string;
|
|
89
89
|
summary?: string;
|
|
@@ -215,8 +215,8 @@ export interface EncodingObjectWithRef {
|
|
|
215
215
|
explode?: boolean;
|
|
216
216
|
allowReserved?: boolean;
|
|
217
217
|
}
|
|
218
|
-
export
|
|
219
|
-
export
|
|
218
|
+
export type ResponsesObject = Map<ResponseObject>;
|
|
219
|
+
export type ResponsesObjectWithRef = Map<ResponseObjectWithRef | ReferenceObject>;
|
|
220
220
|
export interface ResponseObject {
|
|
221
221
|
description: string;
|
|
222
222
|
headers?: Map<HeaderObject>;
|
|
@@ -229,8 +229,8 @@ export interface ResponseObjectWithRef {
|
|
|
229
229
|
content?: Map<MediaTypeObjectWithRef>;
|
|
230
230
|
links?: Map<LinkObject | ReferenceObject>;
|
|
231
231
|
}
|
|
232
|
-
export
|
|
233
|
-
export
|
|
232
|
+
export type CallbackObject = Map<PathItemObject>;
|
|
233
|
+
export type CallbackObjectWithRef = Map<PathItemObjectWithRef>;
|
|
234
234
|
export interface ExampleObject {
|
|
235
235
|
summary?: string;
|
|
236
236
|
description?: string;
|
|
@@ -245,8 +245,8 @@ export interface LinkObject {
|
|
|
245
245
|
description?: string;
|
|
246
246
|
server?: ServerObject;
|
|
247
247
|
}
|
|
248
|
-
export
|
|
249
|
-
export
|
|
248
|
+
export type HeaderObject = Omit<ParameterObject, "name" | "in">;
|
|
249
|
+
export type HeaderObjectWithRef = Omit<ParameterObjectWithRef, "name" | "in">;
|
|
250
250
|
export interface TagObject {
|
|
251
251
|
name?: string;
|
|
252
252
|
description?: string;
|
|
@@ -260,8 +260,8 @@ export interface TagGroupObject {
|
|
|
260
260
|
export interface ReferenceObject {
|
|
261
261
|
$ref: string;
|
|
262
262
|
}
|
|
263
|
-
export
|
|
264
|
-
export
|
|
263
|
+
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
264
|
+
export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
265
265
|
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
266
266
|
allOf?: SchemaObject[];
|
|
267
267
|
oneOf?: SchemaObject[];
|
|
@@ -279,7 +279,7 @@ export declare type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" |
|
|
|
279
279
|
example?: any;
|
|
280
280
|
deprecated?: boolean;
|
|
281
281
|
};
|
|
282
|
-
export
|
|
282
|
+
export type SchemaObjectWithRef = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
283
283
|
type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
284
284
|
allOf?: (SchemaObject | ReferenceObject)[];
|
|
285
285
|
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
@@ -308,7 +308,7 @@ export interface XMLObject {
|
|
|
308
308
|
attribute?: boolean;
|
|
309
309
|
wrapped?: boolean;
|
|
310
310
|
}
|
|
311
|
-
export
|
|
311
|
+
export type SecuritySchemeObject = ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject;
|
|
312
312
|
export interface ApiKeySecuritySchemeObject {
|
|
313
313
|
type: "apiKey";
|
|
314
314
|
description?: string;
|
|
@@ -345,5 +345,5 @@ export interface OAuthFlowObject {
|
|
|
345
345
|
refreshUrl?: string;
|
|
346
346
|
scopes: Map<string>;
|
|
347
347
|
}
|
|
348
|
-
export
|
|
348
|
+
export type SecurityRequirementObject = Map<string[]>;
|
|
349
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
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface APIVersionOptions {
|
|
|
50
50
|
export interface LoadedContent {
|
|
51
51
|
loadedApi: ApiMetadata[];
|
|
52
52
|
}
|
|
53
|
-
export
|
|
53
|
+
export type ApiMetadata = ApiPageMetadata | InfoPageMetadata | TagPageMetadata | SchemaPageMetadata;
|
|
54
54
|
export interface ApiMetadataBase {
|
|
55
55
|
sidebar?: string;
|
|
56
56
|
previous?: ApiNavLink;
|
|
@@ -113,7 +113,7 @@ export interface TagGroupPageMetadata extends ApiMetadataBase {
|
|
|
113
113
|
tags: TagObject[];
|
|
114
114
|
markdown?: string;
|
|
115
115
|
}
|
|
116
|
-
export
|
|
116
|
+
export type ApiInfo = InfoObject;
|
|
117
117
|
export interface ApiNavLink {
|
|
118
118
|
title: string;
|
|
119
119
|
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": "0.0.0-
|
|
4
|
+
"version": "0.0.0-703",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "091f57323887bc2491bfdb3b81a964edae7b9832"
|
|
64
64
|
}
|
|
@@ -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,13 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import { MediaTypeObject } from "../openapi/types";
|
|
9
|
-
import { ApiItem } from "../types";
|
|
10
8
|
import { createDescription } from "./createDescription";
|
|
11
9
|
import { createMethodEndpoint } from "./createMethodEndpoint";
|
|
12
10
|
import { createRequestBodyDetails } from "./createRequestBodyDetails";
|
|
13
11
|
import { createStatusCodes } from "./createStatusCodes";
|
|
14
12
|
import { create } from "./utils";
|
|
13
|
+
import { MediaTypeObject } from "../openapi/types";
|
|
14
|
+
import { ApiItem } from "../types";
|
|
15
15
|
|
|
16
16
|
interface Props {
|
|
17
17
|
callbacks: ApiItem["callbacks"];
|
|
@@ -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,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,8 +7,8 @@
|
|
|
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
14
|
it("should create readable MODs for oneOf primitive properties", () => {
|
|
@@ -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,18 +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 {
|
|
15
|
-
ApiPageMetadata,
|
|
16
|
-
InfoPageMetadata,
|
|
17
|
-
SchemaPageMetadata,
|
|
18
|
-
TagPageMetadata,
|
|
19
|
-
} from "../types";
|
|
20
8
|
import { createAuthentication } from "./createAuthentication";
|
|
21
9
|
import { createAuthorization } from "./createAuthorization";
|
|
22
10
|
import { createCallbacks } from "./createCallbacks";
|
|
@@ -37,6 +25,18 @@ import { createTermsOfService } from "./createTermsOfService";
|
|
|
37
25
|
import { createVendorExtensions } from "./createVendorExtensions";
|
|
38
26
|
import { createVersionBadge } from "./createVersionBadge";
|
|
39
27
|
import { create, greaterThan, lessThan, render } from "./utils";
|
|
28
|
+
import {
|
|
29
|
+
ContactObject,
|
|
30
|
+
LicenseObject,
|
|
31
|
+
MediaTypeObject,
|
|
32
|
+
SecuritySchemeObject,
|
|
33
|
+
} from "../openapi/types";
|
|
34
|
+
import {
|
|
35
|
+
ApiPageMetadata,
|
|
36
|
+
InfoPageMetadata,
|
|
37
|
+
SchemaPageMetadata,
|
|
38
|
+
TagPageMetadata,
|
|
39
|
+
} from "../types";
|
|
40
40
|
|
|
41
41
|
interface RequestBodyProps {
|
|
42
42
|
title: 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;
|
|
@@ -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, TagGroupObject, TagObject } from "./types";
|
|
23
|
+
import { loadAndResolveSpec } from "./utils/loadAndResolveSpec";
|
|
21
24
|
import { isURL } from "../index";
|
|
22
25
|
import {
|
|
23
26
|
ApiMetadata,
|
|
@@ -28,9 +31,6 @@ import {
|
|
|
28
31
|
SidebarOptions,
|
|
29
32
|
TagPageMetadata,
|
|
30
33
|
} from "../types";
|
|
31
|
-
import { sampleRequestFromSchema } from "./createRequestExample";
|
|
32
|
-
import { OpenApiObject, TagGroupObject, TagObject } from "./types";
|
|
33
|
-
import { loadAndResolveSpec } from "./utils/loadAndResolveSpec";
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* 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
|
|
|
@@ -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
|