docusaurus-plugin-openapi-docs 1.0.6 → 1.1.2
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 -2
- package/lib/markdown/createSchemaDetails.js +325 -132
- package/lib/markdown/index.js +1 -0
- package/lib/markdown/schema.js +25 -9
- package/lib/markdown/utils.d.ts +1 -1
- package/lib/markdown/utils.js +4 -1
- package/lib/openapi/openapi.d.ts +3 -3
- package/lib/openapi/openapi.js +30 -26
- package/lib/openapi/types.d.ts +2 -1
- package/lib/openapi/utils/loadAndResolveSpec.d.ts +2 -0
- package/lib/openapi/utils/{loadAndBundleSpec.js → loadAndResolveSpec.js} +61 -28
- package/lib/openapi/utils/services/OpenAPIParser.d.ts +52 -0
- package/lib/openapi/utils/services/OpenAPIParser.js +342 -0
- package/lib/openapi/utils/services/RedocNormalizedOptions.d.ts +100 -0
- package/lib/openapi/utils/services/RedocNormalizedOptions.js +170 -0
- package/lib/openapi/utils/types/index.d.ts +2 -0
- package/lib/openapi/utils/types/index.js +23 -0
- package/lib/openapi/utils/types/open-api.d.ts +305 -0
- package/lib/openapi/utils/types/open-api.js +8 -0
- package/lib/openapi/utils/utils/JsonPointer.d.ts +51 -0
- package/lib/openapi/utils/utils/JsonPointer.js +95 -0
- package/lib/openapi/utils/utils/helpers.d.ts +43 -0
- package/lib/openapi/utils/utils/helpers.js +230 -0
- package/lib/openapi/utils/utils/index.d.ts +3 -0
- package/lib/openapi/utils/utils/index.js +25 -0
- package/lib/openapi/utils/utils/openapi.d.ts +40 -0
- package/lib/openapi/utils/utils/openapi.js +605 -0
- package/lib/sidebars/index.js +5 -3
- package/package.json +15 -11
- package/src/markdown/createSchemaDetails.ts +405 -159
- package/src/markdown/index.ts +1 -0
- package/src/markdown/schema.ts +28 -8
- package/src/markdown/utils.ts +5 -2
- package/src/openapi/openapi.ts +42 -38
- package/src/openapi/types.ts +2 -1
- package/src/openapi/utils/loadAndResolveSpec.ts +123 -0
- package/src/openapi/utils/services/OpenAPIParser.ts +433 -0
- package/src/openapi/utils/services/RedocNormalizedOptions.ts +330 -0
- package/src/openapi/utils/types/index.ts +10 -0
- package/src/openapi/utils/types/open-api.ts +303 -0
- package/src/openapi/utils/utils/JsonPointer.ts +99 -0
- package/src/openapi/utils/utils/helpers.ts +239 -0
- package/src/openapi/utils/utils/index.ts +11 -0
- package/src/openapi/utils/utils/openapi.ts +771 -0
- package/src/sidebars/index.ts +7 -4
- package/lib/openapi/utils/loadAndBundleSpec.d.ts +0 -3
- package/src/openapi/utils/loadAndBundleSpec.ts +0 -93
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare enum SideNavStyleEnum {
|
|
2
|
+
SummaryOnly = "summary-only",
|
|
3
|
+
PathOnly = "path-only",
|
|
4
|
+
IdOnly = "id-only"
|
|
5
|
+
}
|
|
6
|
+
export interface RedocRawOptions {
|
|
7
|
+
scrollYOffset?: number | string | (() => number);
|
|
8
|
+
hideHostname?: boolean | string;
|
|
9
|
+
expandResponses?: string | "all";
|
|
10
|
+
requiredPropsFirst?: boolean | string;
|
|
11
|
+
sortPropsAlphabetically?: boolean | string;
|
|
12
|
+
sortEnumValuesAlphabetically?: boolean | string;
|
|
13
|
+
sortOperationsAlphabetically?: boolean | string;
|
|
14
|
+
sortTagsAlphabetically?: boolean | string;
|
|
15
|
+
nativeScrollbars?: boolean | string;
|
|
16
|
+
pathInMiddlePanel?: boolean | string;
|
|
17
|
+
untrustedSpec?: boolean | string;
|
|
18
|
+
hideLoading?: boolean | string;
|
|
19
|
+
hideDownloadButton?: boolean | string;
|
|
20
|
+
downloadFileName?: string;
|
|
21
|
+
downloadDefinitionUrl?: string;
|
|
22
|
+
disableSearch?: boolean | string;
|
|
23
|
+
onlyRequiredInSamples?: boolean | string;
|
|
24
|
+
showExtensions?: boolean | string | string[];
|
|
25
|
+
sideNavStyle?: SideNavStyleEnum;
|
|
26
|
+
hideSingleRequestSampleTab?: boolean | string;
|
|
27
|
+
menuToggle?: boolean | string;
|
|
28
|
+
jsonSampleExpandLevel?: number | string | "all";
|
|
29
|
+
hideSchemaTitles?: boolean | string;
|
|
30
|
+
simpleOneOfTypeLabel?: boolean | string;
|
|
31
|
+
payloadSampleIdx?: number;
|
|
32
|
+
expandSingleSchemaField?: boolean | string;
|
|
33
|
+
schemaExpansionLevel?: number | string | "all";
|
|
34
|
+
showObjectSchemaExamples?: boolean | string;
|
|
35
|
+
showSecuritySchemeType?: boolean;
|
|
36
|
+
hideSecuritySection?: boolean;
|
|
37
|
+
unstable_ignoreMimeParameters?: boolean;
|
|
38
|
+
enumSkipQuotes?: boolean | string;
|
|
39
|
+
expandDefaultServerVariables?: boolean;
|
|
40
|
+
maxDisplayedEnumValues?: number;
|
|
41
|
+
ignoreNamedSchemas?: string[] | string;
|
|
42
|
+
hideSchemaPattern?: boolean;
|
|
43
|
+
generatedPayloadSamplesMaxDepth?: number;
|
|
44
|
+
nonce?: string;
|
|
45
|
+
hideFab?: boolean;
|
|
46
|
+
minCharacterLengthToInitSearch?: number;
|
|
47
|
+
showWebhookVerb?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare function argValueToBoolean(val?: string | boolean, defaultValue?: boolean): boolean;
|
|
50
|
+
export declare class RedocNormalizedOptions {
|
|
51
|
+
static normalizeExpandResponses(value: RedocRawOptions["expandResponses"]): {};
|
|
52
|
+
static normalizeHideHostname(value: RedocRawOptions["hideHostname"]): boolean;
|
|
53
|
+
static normalizeShowExtensions(value: RedocRawOptions["showExtensions"]): string[] | boolean;
|
|
54
|
+
static normalizeSideNavStyle(value: RedocRawOptions["sideNavStyle"]): SideNavStyleEnum;
|
|
55
|
+
static normalizePayloadSampleIdx(value: RedocRawOptions["payloadSampleIdx"]): number;
|
|
56
|
+
private static normalizeJsonSampleExpandLevel;
|
|
57
|
+
private static normalizeGeneratedPayloadSamplesMaxDepth;
|
|
58
|
+
hideHostname: boolean;
|
|
59
|
+
expandResponses: {
|
|
60
|
+
[code: string]: boolean;
|
|
61
|
+
} | "all";
|
|
62
|
+
requiredPropsFirst: boolean;
|
|
63
|
+
sortPropsAlphabetically: boolean;
|
|
64
|
+
sortEnumValuesAlphabetically: boolean;
|
|
65
|
+
sortOperationsAlphabetically: boolean;
|
|
66
|
+
sortTagsAlphabetically: boolean;
|
|
67
|
+
nativeScrollbars: boolean;
|
|
68
|
+
pathInMiddlePanel: boolean;
|
|
69
|
+
untrustedSpec: boolean;
|
|
70
|
+
hideDownloadButton: boolean;
|
|
71
|
+
downloadFileName?: string;
|
|
72
|
+
downloadDefinitionUrl?: string;
|
|
73
|
+
disableSearch: boolean;
|
|
74
|
+
onlyRequiredInSamples: boolean;
|
|
75
|
+
showExtensions: boolean | string[];
|
|
76
|
+
sideNavStyle: SideNavStyleEnum;
|
|
77
|
+
hideSingleRequestSampleTab: boolean;
|
|
78
|
+
menuToggle: boolean;
|
|
79
|
+
jsonSampleExpandLevel: number;
|
|
80
|
+
enumSkipQuotes: boolean;
|
|
81
|
+
hideSchemaTitles: boolean;
|
|
82
|
+
simpleOneOfTypeLabel: boolean;
|
|
83
|
+
payloadSampleIdx: number;
|
|
84
|
+
expandSingleSchemaField: boolean;
|
|
85
|
+
schemaExpansionLevel: number;
|
|
86
|
+
showObjectSchemaExamples: boolean;
|
|
87
|
+
showSecuritySchemeType?: boolean;
|
|
88
|
+
hideSecuritySection?: boolean;
|
|
89
|
+
unstable_ignoreMimeParameters: boolean;
|
|
90
|
+
expandDefaultServerVariables: boolean;
|
|
91
|
+
maxDisplayedEnumValues?: number;
|
|
92
|
+
ignoreNamedSchemas: Set<string>;
|
|
93
|
+
hideSchemaPattern: boolean;
|
|
94
|
+
generatedPayloadSamplesMaxDepth: number;
|
|
95
|
+
hideFab: boolean;
|
|
96
|
+
minCharacterLengthToInitSearch: number;
|
|
97
|
+
showWebhookVerb: boolean;
|
|
98
|
+
nonce?: string;
|
|
99
|
+
constructor(raw: RedocRawOptions, defaults?: RedocRawOptions);
|
|
100
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RedocNormalizedOptions = exports.argValueToBoolean = exports.SideNavStyleEnum = void 0;
|
|
10
|
+
// @ts-nocheck
|
|
11
|
+
const helpers_1 = require("../utils/helpers");
|
|
12
|
+
var SideNavStyleEnum;
|
|
13
|
+
(function (SideNavStyleEnum) {
|
|
14
|
+
SideNavStyleEnum["SummaryOnly"] = "summary-only";
|
|
15
|
+
SideNavStyleEnum["PathOnly"] = "path-only";
|
|
16
|
+
SideNavStyleEnum["IdOnly"] = "id-only";
|
|
17
|
+
})(SideNavStyleEnum = exports.SideNavStyleEnum || (exports.SideNavStyleEnum = {}));
|
|
18
|
+
function argValueToBoolean(val, defaultValue) {
|
|
19
|
+
if (val === undefined) {
|
|
20
|
+
return defaultValue || false;
|
|
21
|
+
}
|
|
22
|
+
if (typeof val === "string") {
|
|
23
|
+
return val !== "false";
|
|
24
|
+
}
|
|
25
|
+
return val;
|
|
26
|
+
}
|
|
27
|
+
exports.argValueToBoolean = argValueToBoolean;
|
|
28
|
+
function argValueToNumber(value) {
|
|
29
|
+
if (typeof value === "string") {
|
|
30
|
+
return parseInt(value, 10);
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === "number") {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function argValueToExpandLevel(value, defaultValue = 0) {
|
|
37
|
+
if (value === "all")
|
|
38
|
+
return Infinity;
|
|
39
|
+
return argValueToNumber(value) || defaultValue;
|
|
40
|
+
}
|
|
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
|
+
static normalizeExpandResponses(value) {
|
|
92
|
+
if (value === "all") {
|
|
93
|
+
return "all";
|
|
94
|
+
}
|
|
95
|
+
if (typeof value === "string") {
|
|
96
|
+
const res = {};
|
|
97
|
+
value.split(",").forEach((code) => {
|
|
98
|
+
res[code.trim()] = true;
|
|
99
|
+
});
|
|
100
|
+
return res;
|
|
101
|
+
}
|
|
102
|
+
else if (value !== undefined) {
|
|
103
|
+
console.warn(`expandResponses must be a string but received value "${value}" of type ${typeof value}`);
|
|
104
|
+
}
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
static normalizeHideHostname(value) {
|
|
108
|
+
return !!value;
|
|
109
|
+
}
|
|
110
|
+
static normalizeShowExtensions(value) {
|
|
111
|
+
if (typeof value === "undefined") {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (value === "") {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
if (typeof value !== "string") {
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
switch (value) {
|
|
121
|
+
case "true":
|
|
122
|
+
return true;
|
|
123
|
+
case "false":
|
|
124
|
+
return false;
|
|
125
|
+
default:
|
|
126
|
+
return value.split(",").map((ext) => ext.trim());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
static normalizeSideNavStyle(value) {
|
|
130
|
+
const defaultValue = SideNavStyleEnum.SummaryOnly;
|
|
131
|
+
if (typeof value !== "string") {
|
|
132
|
+
return defaultValue;
|
|
133
|
+
}
|
|
134
|
+
switch (value) {
|
|
135
|
+
case defaultValue:
|
|
136
|
+
return value;
|
|
137
|
+
case SideNavStyleEnum.PathOnly:
|
|
138
|
+
return SideNavStyleEnum.PathOnly;
|
|
139
|
+
case SideNavStyleEnum.IdOnly:
|
|
140
|
+
return SideNavStyleEnum.IdOnly;
|
|
141
|
+
default:
|
|
142
|
+
return defaultValue;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
static normalizePayloadSampleIdx(value) {
|
|
146
|
+
if (typeof value === "number") {
|
|
147
|
+
return Math.max(0, value); // always greater or equal than 0
|
|
148
|
+
}
|
|
149
|
+
if (typeof value === "string") {
|
|
150
|
+
return isFinite(value) ? parseInt(value, 10) : 0;
|
|
151
|
+
}
|
|
152
|
+
return 0;
|
|
153
|
+
}
|
|
154
|
+
static normalizeJsonSampleExpandLevel(level) {
|
|
155
|
+
if (level === "all") {
|
|
156
|
+
return +Infinity;
|
|
157
|
+
}
|
|
158
|
+
if (!isNaN(Number(level))) {
|
|
159
|
+
return Math.ceil(Number(level));
|
|
160
|
+
}
|
|
161
|
+
return 2;
|
|
162
|
+
}
|
|
163
|
+
static normalizeGeneratedPayloadSamplesMaxDepth(value) {
|
|
164
|
+
if (!isNaN(Number(value))) {
|
|
165
|
+
return Math.max(0, Number(value));
|
|
166
|
+
}
|
|
167
|
+
return 10;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.RedocNormalizedOptions = RedocNormalizedOptions;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
__exportStar(require("./open-api"), exports);
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { Omit } from "./index";
|
|
2
|
+
export interface OpenAPISpec {
|
|
3
|
+
openapi: string;
|
|
4
|
+
info: OpenAPIInfo;
|
|
5
|
+
servers?: OpenAPIServer[];
|
|
6
|
+
paths: OpenAPIPaths;
|
|
7
|
+
components?: OpenAPIComponents;
|
|
8
|
+
security?: OpenAPISecurityRequirement[];
|
|
9
|
+
tags?: OpenAPITag[];
|
|
10
|
+
externalDocs?: OpenAPIExternalDocumentation;
|
|
11
|
+
"x-webhooks"?: OpenAPIPaths;
|
|
12
|
+
webhooks?: OpenAPIPaths;
|
|
13
|
+
}
|
|
14
|
+
export interface OpenAPIInfo {
|
|
15
|
+
title: string;
|
|
16
|
+
version: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
summary?: string;
|
|
19
|
+
termsOfService?: string;
|
|
20
|
+
contact?: OpenAPIContact;
|
|
21
|
+
license?: OpenAPILicense;
|
|
22
|
+
}
|
|
23
|
+
export interface OpenAPIServer {
|
|
24
|
+
url: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
variables?: {
|
|
27
|
+
[name: string]: OpenAPIServerVariable;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface OpenAPIServerVariable {
|
|
31
|
+
enum?: string[];
|
|
32
|
+
default: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface OpenAPIPaths {
|
|
36
|
+
[path: string]: OpenAPIPath;
|
|
37
|
+
}
|
|
38
|
+
export interface OpenAPIRef {
|
|
39
|
+
$ref: string;
|
|
40
|
+
}
|
|
41
|
+
export declare type Referenced<T> = OpenAPIRef | T;
|
|
42
|
+
export interface OpenAPIPath {
|
|
43
|
+
summary?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
get?: OpenAPIOperation;
|
|
46
|
+
put?: OpenAPIOperation;
|
|
47
|
+
post?: OpenAPIOperation;
|
|
48
|
+
delete?: OpenAPIOperation;
|
|
49
|
+
options?: OpenAPIOperation;
|
|
50
|
+
head?: OpenAPIOperation;
|
|
51
|
+
patch?: OpenAPIOperation;
|
|
52
|
+
trace?: OpenAPIOperation;
|
|
53
|
+
servers?: OpenAPIServer[];
|
|
54
|
+
parameters?: Array<Referenced<OpenAPIParameter>>;
|
|
55
|
+
$ref?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface OpenAPIXCodeSample {
|
|
58
|
+
lang: string;
|
|
59
|
+
label?: string;
|
|
60
|
+
source: string;
|
|
61
|
+
}
|
|
62
|
+
export interface OpenAPIOperation {
|
|
63
|
+
tags?: string[];
|
|
64
|
+
summary?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
externalDocs?: OpenAPIExternalDocumentation;
|
|
67
|
+
operationId?: string;
|
|
68
|
+
parameters?: Array<Referenced<OpenAPIParameter>>;
|
|
69
|
+
requestBody?: Referenced<OpenAPIRequestBody>;
|
|
70
|
+
responses: OpenAPIResponses;
|
|
71
|
+
callbacks?: {
|
|
72
|
+
[name: string]: Referenced<OpenAPICallback>;
|
|
73
|
+
};
|
|
74
|
+
deprecated?: boolean;
|
|
75
|
+
security?: OpenAPISecurityRequirement[];
|
|
76
|
+
servers?: OpenAPIServer[];
|
|
77
|
+
"x-codeSamples"?: OpenAPIXCodeSample[];
|
|
78
|
+
"x-code-samples"?: OpenAPIXCodeSample[];
|
|
79
|
+
}
|
|
80
|
+
export interface OpenAPIParameter {
|
|
81
|
+
name: string;
|
|
82
|
+
in?: OpenAPIParameterLocation;
|
|
83
|
+
description?: string;
|
|
84
|
+
required?: boolean;
|
|
85
|
+
deprecated?: boolean;
|
|
86
|
+
allowEmptyValue?: boolean;
|
|
87
|
+
style?: OpenAPIParameterStyle;
|
|
88
|
+
explode?: boolean;
|
|
89
|
+
allowReserved?: boolean;
|
|
90
|
+
schema?: Referenced<OpenAPISchema>;
|
|
91
|
+
example?: any;
|
|
92
|
+
examples?: {
|
|
93
|
+
[media: string]: Referenced<OpenAPIExample>;
|
|
94
|
+
};
|
|
95
|
+
content?: {
|
|
96
|
+
[media: string]: OpenAPIMediaType;
|
|
97
|
+
};
|
|
98
|
+
encoding?: Record<string, OpenAPIEncoding>;
|
|
99
|
+
const?: any;
|
|
100
|
+
}
|
|
101
|
+
export interface OpenAPIExample {
|
|
102
|
+
value: any;
|
|
103
|
+
summary?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
externalValue?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface OpenAPISchema {
|
|
108
|
+
$ref?: string;
|
|
109
|
+
type?: string | string[];
|
|
110
|
+
properties?: {
|
|
111
|
+
[name: string]: OpenAPISchema;
|
|
112
|
+
};
|
|
113
|
+
patternProperties?: {
|
|
114
|
+
[name: string]: OpenAPISchema;
|
|
115
|
+
};
|
|
116
|
+
additionalProperties?: boolean | OpenAPISchema;
|
|
117
|
+
unevaluatedProperties?: boolean | OpenAPISchema;
|
|
118
|
+
description?: string;
|
|
119
|
+
default?: any;
|
|
120
|
+
items?: OpenAPISchema | OpenAPISchema[] | boolean;
|
|
121
|
+
required?: string[];
|
|
122
|
+
readOnly?: boolean;
|
|
123
|
+
writeOnly?: boolean;
|
|
124
|
+
deprecated?: boolean;
|
|
125
|
+
format?: string;
|
|
126
|
+
externalDocs?: OpenAPIExternalDocumentation;
|
|
127
|
+
discriminator?: OpenAPIDiscriminator;
|
|
128
|
+
nullable?: boolean;
|
|
129
|
+
oneOf?: OpenAPISchema[];
|
|
130
|
+
anyOf?: OpenAPISchema[];
|
|
131
|
+
allOf?: OpenAPISchema[];
|
|
132
|
+
not?: OpenAPISchema;
|
|
133
|
+
title?: string;
|
|
134
|
+
multipleOf?: number;
|
|
135
|
+
maximum?: number;
|
|
136
|
+
exclusiveMaximum?: boolean | number;
|
|
137
|
+
minimum?: number;
|
|
138
|
+
exclusiveMinimum?: boolean | number;
|
|
139
|
+
maxLength?: number;
|
|
140
|
+
minLength?: number;
|
|
141
|
+
pattern?: string;
|
|
142
|
+
maxItems?: number;
|
|
143
|
+
minItems?: number;
|
|
144
|
+
uniqueItems?: boolean;
|
|
145
|
+
maxProperties?: number;
|
|
146
|
+
minProperties?: number;
|
|
147
|
+
enum?: any[];
|
|
148
|
+
example?: any;
|
|
149
|
+
if?: OpenAPISchema;
|
|
150
|
+
else?: OpenAPISchema;
|
|
151
|
+
then?: OpenAPISchema;
|
|
152
|
+
examples?: any[];
|
|
153
|
+
const?: string;
|
|
154
|
+
contentEncoding?: string;
|
|
155
|
+
contentMediaType?: string;
|
|
156
|
+
prefixItems?: OpenAPISchema[];
|
|
157
|
+
additionalItems?: OpenAPISchema | boolean;
|
|
158
|
+
}
|
|
159
|
+
export interface OpenAPIDiscriminator {
|
|
160
|
+
propertyName: string;
|
|
161
|
+
mapping?: {
|
|
162
|
+
[name: string]: string;
|
|
163
|
+
};
|
|
164
|
+
"x-explicitMappingOnly"?: boolean;
|
|
165
|
+
}
|
|
166
|
+
export interface OpenAPIMediaType {
|
|
167
|
+
schema?: Referenced<OpenAPISchema>;
|
|
168
|
+
example?: any;
|
|
169
|
+
examples?: {
|
|
170
|
+
[name: string]: Referenced<OpenAPIExample>;
|
|
171
|
+
};
|
|
172
|
+
encoding?: {
|
|
173
|
+
[field: string]: OpenAPIEncoding;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export interface OpenAPIEncoding {
|
|
177
|
+
contentType: string;
|
|
178
|
+
headers?: {
|
|
179
|
+
[name: string]: Referenced<OpenAPIHeader>;
|
|
180
|
+
};
|
|
181
|
+
style: OpenAPIParameterStyle;
|
|
182
|
+
explode: boolean;
|
|
183
|
+
allowReserved: boolean;
|
|
184
|
+
}
|
|
185
|
+
export declare type OpenAPIParameterLocation = "query" | "header" | "path" | "cookie";
|
|
186
|
+
export declare type OpenAPIParameterStyle = "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject";
|
|
187
|
+
export interface OpenAPIRequestBody {
|
|
188
|
+
description?: string;
|
|
189
|
+
required?: boolean;
|
|
190
|
+
content: {
|
|
191
|
+
[mime: string]: OpenAPIMediaType;
|
|
192
|
+
};
|
|
193
|
+
"x-examples"?: {
|
|
194
|
+
[mime: string]: {
|
|
195
|
+
[name: string]: Referenced<OpenAPIExample>;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
"x-example"?: {
|
|
199
|
+
[mime: string]: any;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export interface OpenAPIResponses {
|
|
203
|
+
[code: string]: Referenced<OpenAPIResponse>;
|
|
204
|
+
}
|
|
205
|
+
export interface OpenAPIResponse extends Pick<OpenAPIRequestBody, "description" | "x-examples" | "x-example"> {
|
|
206
|
+
headers?: {
|
|
207
|
+
[name: string]: Referenced<OpenAPIHeader>;
|
|
208
|
+
};
|
|
209
|
+
links?: {
|
|
210
|
+
[name: string]: Referenced<OpenAPILink>;
|
|
211
|
+
};
|
|
212
|
+
content?: {
|
|
213
|
+
[mime: string]: OpenAPIMediaType;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
export interface OpenAPILink {
|
|
217
|
+
$ref?: string;
|
|
218
|
+
}
|
|
219
|
+
export declare type OpenAPIHeader = Omit<OpenAPIParameter, "in" | "name">;
|
|
220
|
+
export interface OpenAPICallback {
|
|
221
|
+
[name: string]: OpenAPIPath;
|
|
222
|
+
}
|
|
223
|
+
export interface OpenAPIComponents {
|
|
224
|
+
schemas?: {
|
|
225
|
+
[name: string]: Referenced<OpenAPISchema>;
|
|
226
|
+
};
|
|
227
|
+
responses?: {
|
|
228
|
+
[name: string]: Referenced<OpenAPIResponse>;
|
|
229
|
+
};
|
|
230
|
+
parameters?: {
|
|
231
|
+
[name: string]: Referenced<OpenAPIParameter>;
|
|
232
|
+
};
|
|
233
|
+
examples?: {
|
|
234
|
+
[name: string]: Referenced<OpenAPIExample>;
|
|
235
|
+
};
|
|
236
|
+
requestBodies?: {
|
|
237
|
+
[name: string]: Referenced<OpenAPIRequestBody>;
|
|
238
|
+
};
|
|
239
|
+
headers?: {
|
|
240
|
+
[name: string]: Referenced<OpenAPIHeader>;
|
|
241
|
+
};
|
|
242
|
+
securitySchemes?: {
|
|
243
|
+
[name: string]: Referenced<OpenAPISecurityScheme>;
|
|
244
|
+
};
|
|
245
|
+
links?: {
|
|
246
|
+
[name: string]: Referenced<OpenAPILink>;
|
|
247
|
+
};
|
|
248
|
+
callbacks?: {
|
|
249
|
+
[name: string]: Referenced<OpenAPICallback>;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
export interface OpenAPISecurityRequirement {
|
|
253
|
+
[name: string]: string[];
|
|
254
|
+
}
|
|
255
|
+
export interface OpenAPISecurityScheme {
|
|
256
|
+
type: "apiKey" | "http" | "oauth2" | "openIdConnect";
|
|
257
|
+
description?: string;
|
|
258
|
+
name?: string;
|
|
259
|
+
in?: "query" | "header" | "cookie";
|
|
260
|
+
scheme?: string;
|
|
261
|
+
bearerFormat: string;
|
|
262
|
+
flows: {
|
|
263
|
+
implicit?: {
|
|
264
|
+
refreshUrl?: string;
|
|
265
|
+
scopes: Record<string, string>;
|
|
266
|
+
authorizationUrl: string;
|
|
267
|
+
};
|
|
268
|
+
password?: {
|
|
269
|
+
refreshUrl?: string;
|
|
270
|
+
scopes: Record<string, string>;
|
|
271
|
+
tokenUrl: string;
|
|
272
|
+
};
|
|
273
|
+
clientCredentials?: {
|
|
274
|
+
refreshUrl?: string;
|
|
275
|
+
scopes: Record<string, string>;
|
|
276
|
+
tokenUrl: string;
|
|
277
|
+
};
|
|
278
|
+
authorizationCode?: {
|
|
279
|
+
refreshUrl?: string;
|
|
280
|
+
scopes: Record<string, string>;
|
|
281
|
+
tokenUrl: string;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
openIdConnectUrl?: string;
|
|
285
|
+
}
|
|
286
|
+
export interface OpenAPITag {
|
|
287
|
+
name: string;
|
|
288
|
+
description?: string;
|
|
289
|
+
externalDocs?: OpenAPIExternalDocumentation;
|
|
290
|
+
"x-displayName"?: string;
|
|
291
|
+
}
|
|
292
|
+
export interface OpenAPIExternalDocumentation {
|
|
293
|
+
description?: string;
|
|
294
|
+
url: string;
|
|
295
|
+
}
|
|
296
|
+
export interface OpenAPIContact {
|
|
297
|
+
name?: string;
|
|
298
|
+
url?: string;
|
|
299
|
+
email?: string;
|
|
300
|
+
}
|
|
301
|
+
export interface OpenAPILicense {
|
|
302
|
+
name: string;
|
|
303
|
+
url?: string;
|
|
304
|
+
identifier?: string;
|
|
305
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper for JsonPointer. Provides common operations
|
|
3
|
+
*/
|
|
4
|
+
export declare class JsonPointer {
|
|
5
|
+
/**
|
|
6
|
+
* returns last JsonPointer token
|
|
7
|
+
* if level > 1 returns levels last (second last/third last)
|
|
8
|
+
* @example
|
|
9
|
+
* // returns subpath
|
|
10
|
+
* JsonPointerHelper.baseName('/path/0/subpath')
|
|
11
|
+
* // returns foo
|
|
12
|
+
* JsonPointerHelper.baseName('/path/foo/subpath', 2)
|
|
13
|
+
*/
|
|
14
|
+
static baseName(pointer: any, level?: number): string;
|
|
15
|
+
/**
|
|
16
|
+
* returns dirname of pointer
|
|
17
|
+
* if level > 1 returns corresponding dirname in the hierarchy
|
|
18
|
+
* @example
|
|
19
|
+
* // returns /path/0
|
|
20
|
+
* JsonPointerHelper.dirName('/path/0/subpath')
|
|
21
|
+
* // returns /path
|
|
22
|
+
* JsonPointerHelper.dirName('/path/foo/subpath', 2)
|
|
23
|
+
*/
|
|
24
|
+
static dirName(pointer: any, level?: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* returns relative path tokens
|
|
27
|
+
* @example
|
|
28
|
+
* // returns ['subpath']
|
|
29
|
+
* JsonPointerHelper.relative('/path/0', '/path/0/subpath')
|
|
30
|
+
* // returns ['foo', 'subpath']
|
|
31
|
+
* JsonPointerHelper.relative('/path', '/path/foo/subpath')
|
|
32
|
+
*/
|
|
33
|
+
static relative(from: any, to: any): string[];
|
|
34
|
+
/**
|
|
35
|
+
* overridden JsonPointer original parse to take care of prefixing '#' symbol
|
|
36
|
+
* that is not valid JsonPointer
|
|
37
|
+
*/
|
|
38
|
+
static parse(pointer: any): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Creates a JSON pointer path, by joining one or more tokens to a base path.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} base - The base path
|
|
43
|
+
* @param {string|string[]} tokens - The token(s) to append (e.g. ["name", "first"])
|
|
44
|
+
* @returns {string}
|
|
45
|
+
*/
|
|
46
|
+
static join(base: any, tokens: any): string;
|
|
47
|
+
static get(object: object, pointer: string): any;
|
|
48
|
+
static compile(tokens: string[]): string;
|
|
49
|
+
static escape(pointer: string): string;
|
|
50
|
+
}
|
|
51
|
+
export default JsonPointer;
|