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