docusaurus-plugin-openapi-docs 0.0.0-362 → 0.0.0-367

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import type { LoadContext, Plugin } from "@docusaurus/types";
2
2
  import type { PluginOptions, LoadedContent } from "./types";
3
+ export declare function isURL(str: string): boolean;
3
4
  export default function pluginOpenAPI(context: LoadContext, options: PluginOptions): Plugin<LoadedContent>;
package/lib/index.js CHANGED
@@ -9,6 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isURL = void 0;
12
13
  const fs_1 = __importDefault(require("fs"));
13
14
  const path_1 = __importDefault(require("path"));
14
15
  const utils_1 = require("@docusaurus/utils");
@@ -17,12 +18,18 @@ const mustache_1 = require("mustache");
17
18
  const markdown_1 = require("./markdown");
18
19
  const openapi_1 = require("./openapi");
19
20
  const sidebars_1 = __importDefault(require("./sidebars"));
21
+ function isURL(str) {
22
+ return /^(https?:)\/\//m.test(str);
23
+ }
24
+ exports.isURL = isURL;
20
25
  function pluginOpenAPI(context, options) {
21
26
  let { config } = options;
22
27
  let { siteDir } = context;
23
28
  async function generateApiDocs(options) {
24
29
  let { specPath, outputDir, template, sidebarOptions } = options;
25
- const contentPath = path_1.default.resolve(siteDir, specPath);
30
+ const contentPath = isURL(specPath)
31
+ ? specPath
32
+ : path_1.default.resolve(siteDir, specPath);
26
33
  try {
27
34
  const openapiFiles = await (0, openapi_1.readOpenapiFiles)(contentPath, {});
28
35
  const [loadedApi, tags] = await (0, openapi_1.processOpenapiFiles)(openapiFiles, sidebarOptions);
@@ -78,6 +85,9 @@ api: {{{json}}}
78
85
  {{#api.method}}
79
86
  sidebar_class_name: "{{{api.method}}} api-method"
80
87
  {{/api.method}}
88
+ {{#infoPath}}
89
+ info_path: {{{infoPath}}}
90
+ {{/infoPath}}
81
91
  ---
82
92
 
83
93
  {{{markdown}}}
@@ -125,6 +135,8 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
125
135
  item.markdown = markdown;
126
136
  if (item.type === "api") {
127
137
  item.json = JSON.stringify(item.api);
138
+ if (item.infoId)
139
+ item.infoPath = `${outputDir}/${item.infoId}`;
128
140
  }
129
141
  const view = (0, mustache_1.render)(mdTemplate, item);
130
142
  const utils = (0, mustache_1.render)(infoMdTemplate, item);
@@ -0,0 +1,2 @@
1
+ import { SecuritySchemeObject } from "../openapi/types";
2
+ export declare function createAuthentication(securitySchemes: SecuritySchemeObject): string;
@@ -0,0 +1,139 @@
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.createAuthentication = void 0;
10
+ const createDescription_1 = require("./createDescription");
11
+ const utils_1 = require("./utils");
12
+ function createAuthentication(securitySchemes) {
13
+ if (!securitySchemes || !Object.keys(securitySchemes).length)
14
+ return "";
15
+ const createAuthenticationTable = (securityScheme) => {
16
+ const { bearerFormat, flows, name, scheme, type } = securityScheme;
17
+ const createSecuritySchemeTypeRow = () => (0, utils_1.create)("tr", {
18
+ children: [
19
+ (0, utils_1.create)("th", { children: "Security Scheme Type:" }),
20
+ (0, utils_1.create)("td", { children: type }),
21
+ ],
22
+ });
23
+ const createOAuthFlowRows = () => {
24
+ const flowRows = Object.entries(flows).map(([flowType, flowObj]) => {
25
+ const { authorizationUrl, tokenUrl, refreshUrl, scopes } = flowObj;
26
+ return (0, utils_1.create)("tr", {
27
+ children: [
28
+ (0, utils_1.create)("th", { children: `${flowType} OAuth Flow:` }),
29
+ (0, utils_1.create)("td", {
30
+ children: [
31
+ (0, utils_1.guard)(tokenUrl, () => (0, utils_1.create)("p", { children: `Token URL: ${tokenUrl}` })),
32
+ (0, utils_1.guard)(authorizationUrl, () => (0, utils_1.create)("p", {
33
+ children: `Authorization URL: ${authorizationUrl}`,
34
+ })),
35
+ (0, utils_1.guard)(refreshUrl, () => (0, utils_1.create)("p", { children: `Refresh URL: ${refreshUrl}` })),
36
+ (0, utils_1.create)("span", { children: "Scopes:" }),
37
+ (0, utils_1.create)("ul", {
38
+ children: Object.entries(scopes).map(([scope, description]) => (0, utils_1.create)("li", { children: `${scope}: ${description}` })),
39
+ }),
40
+ ],
41
+ }),
42
+ ],
43
+ });
44
+ });
45
+ return flowRows.join("");
46
+ };
47
+ switch (type) {
48
+ case "apiKey":
49
+ return (0, utils_1.create)("div", {
50
+ children: [
51
+ (0, utils_1.create)("table", {
52
+ children: (0, utils_1.create)("tbody", {
53
+ children: [
54
+ createSecuritySchemeTypeRow(),
55
+ (0, utils_1.create)("tr", {
56
+ children: [
57
+ (0, utils_1.create)("th", { children: "Header parameter name:" }),
58
+ (0, utils_1.create)("td", { children: name }),
59
+ ],
60
+ }),
61
+ ],
62
+ }),
63
+ }),
64
+ ],
65
+ });
66
+ case "http":
67
+ return (0, utils_1.create)("div", {
68
+ children: [
69
+ (0, utils_1.create)("table", {
70
+ children: (0, utils_1.create)("tbody", {
71
+ children: [
72
+ createSecuritySchemeTypeRow(),
73
+ (0, utils_1.create)("tr", {
74
+ children: [
75
+ (0, utils_1.create)("th", { children: "HTTP Authorization Scheme:" }),
76
+ (0, utils_1.create)("td", { children: scheme }),
77
+ ],
78
+ }),
79
+ (0, utils_1.create)("tr", {
80
+ children: [
81
+ (0, utils_1.create)("th", { children: "Bearer format:" }),
82
+ (0, utils_1.create)("td", { children: bearerFormat }),
83
+ ],
84
+ }),
85
+ ],
86
+ }),
87
+ }),
88
+ ],
89
+ });
90
+ case "oauth2":
91
+ return (0, utils_1.create)("div", {
92
+ children: [
93
+ (0, utils_1.create)("table", {
94
+ children: (0, utils_1.create)("tbody", {
95
+ children: [
96
+ createSecuritySchemeTypeRow(),
97
+ createOAuthFlowRows(),
98
+ ],
99
+ }),
100
+ }),
101
+ ],
102
+ });
103
+ default:
104
+ return "";
105
+ }
106
+ };
107
+ const formatTabLabel = (str) => {
108
+ const formattedLabel = str
109
+ .replace(/(_|-)/g, " ")
110
+ .trim()
111
+ .replace(/\w\S*/g, (str) => str.charAt(0).toUpperCase() + str.substr(1))
112
+ .replace(/([a-z])([A-Z])/g, "$1 $2")
113
+ .replace(/([A-Z])([A-Z][a-z])/g, "$1 $2");
114
+ const isOAuth = formattedLabel.toLowerCase().includes("oauth2");
115
+ const isApiKey = formattedLabel.toLowerCase().includes("api");
116
+ return isOAuth ? "OAuth 2.0" : isApiKey ? "API Key" : formattedLabel;
117
+ };
118
+ return (0, utils_1.create)("div", {
119
+ children: [
120
+ (0, utils_1.create)("h2", {
121
+ children: "Authentication",
122
+ id: "authentication",
123
+ style: { marginBottom: "1rem" },
124
+ }),
125
+ (0, utils_1.create)("Tabs", {
126
+ children: Object.entries(securitySchemes).map(([schemeType, schemeObj]) => (0, utils_1.create)("TabItem", {
127
+ label: formatTabLabel(schemeType),
128
+ value: `${schemeType}`,
129
+ children: [
130
+ (0, createDescription_1.createDescription)(schemeObj.description),
131
+ createAuthenticationTable(schemeObj),
132
+ ],
133
+ })),
134
+ }),
135
+ ],
136
+ style: { marginBottom: "2rem" },
137
+ });
138
+ }
139
+ exports.createAuthentication = createAuthentication;
@@ -1,4 +1,4 @@
1
1
  import { ApiPageMetadata, InfoPageMetadata, TagPageMetadata } from "../types";
2
2
  export declare function createApiPageMD({ title, api: { deprecated, "x-deprecated-description": deprecatedDescription, description, parameters, requestBody, responses, }, }: ApiPageMetadata): string;
3
- export declare function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService }, }: InfoPageMetadata): string;
3
+ export declare function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService }, securitySchemes, }: InfoPageMetadata): string;
4
4
  export declare function createTagPageMD({ tag: { description } }: TagPageMetadata): string;
@@ -8,6 +8,7 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.createTagPageMD = exports.createInfoPageMD = exports.createApiPageMD = void 0;
10
10
  const lodash_1 = require("lodash");
11
+ const createAuthentication_1 = require("./createAuthentication");
11
12
  const createContactInfo_1 = require("./createContactInfo");
12
13
  const createDeprecationNotice_1 = require("./createDeprecationNotice");
13
14
  const createDescription_1 = require("./createDescription");
@@ -36,11 +37,14 @@ function createApiPageMD({ title, api: { deprecated, "x-deprecated-description":
36
37
  ]);
37
38
  }
38
39
  exports.createApiPageMD = createApiPageMD;
39
- function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService }, }) {
40
+ function createInfoPageMD({ info: { title, version, description, contact, license, termsOfService }, securitySchemes, }) {
40
41
  return (0, utils_1.render)([
42
+ `import Tabs from "@theme/Tabs";\n`,
43
+ `import TabItem from "@theme/TabItem";\n`,
41
44
  (0, createVersionBadge_1.createVersionBadge)(version),
42
45
  `# ${(0, lodash_1.escape)(title)}\n\n`,
43
46
  (0, createDescription_1.createDescription)(description),
47
+ (0, createAuthentication_1.createAuthentication)(securitySchemes),
44
48
  (0, createContactInfo_1.createContactInfo)(contact),
45
49
  (0, createTermsOfService_1.createTermsOfService)(termsOfService),
46
50
  (0, createLicense_1.createLicense)(license),
@@ -16,10 +16,11 @@ const openapi_to_postmanv2_1 = __importDefault(require("@paloaltonetworks/openap
16
16
  const postman_collection_1 = __importDefault(require("@paloaltonetworks/postman-collection"));
17
17
  const chalk_1 = __importDefault(require("chalk"));
18
18
  const fs_extra_1 = __importDefault(require("fs-extra"));
19
- const js_yaml_1 = __importDefault(require("js-yaml"));
20
19
  const json_refs_1 = __importDefault(require("json-refs"));
21
20
  const lodash_1 = require("lodash");
21
+ const index_1 = require("../index");
22
22
  const createExample_1 = require("./createExample");
23
+ const loadAndBundleSpec_1 = require("./utils/loadAndBundleSpec");
23
24
  /**
24
25
  * Finds any reference objects in the OpenAPI definition and resolves them to a finalized value.
25
26
  */
@@ -64,9 +65,10 @@ async function createPostmanCollection(openapiData) {
64
65
  return await jsonToCollection(data);
65
66
  }
66
67
  function createItems(openapiData, sidebarOptions) {
67
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
68
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
68
69
  // TODO: Find a better way to handle this
69
70
  let items = [];
71
+ const infoId = (0, lodash_1.kebabCase)(openapiData.info.title);
70
72
  if ((sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.categoryLinkSource) === "tag") {
71
73
  // Only create an tag pages if categoryLinkSource set to tag.
72
74
  const tags = (_a = openapiData.tags) !== null && _a !== void 0 ? _a : [];
@@ -95,7 +97,6 @@ function createItems(openapiData, sidebarOptions) {
95
97
  }
96
98
  if (openapiData.info.description) {
97
99
  // Only create an info page if we have a description.
98
- const infoId = (0, lodash_1.kebabCase)(openapiData.info.title);
99
100
  const infoPage = {
100
101
  type: "info",
101
102
  id: infoId,
@@ -104,10 +105,11 @@ function createItems(openapiData, sidebarOptions) {
104
105
  description: openapiData.info.description,
105
106
  slug: "/" + infoId,
106
107
  frontMatter: {},
108
+ securitySchemes: (_b = openapiData.components) === null || _b === void 0 ? void 0 : _b.securitySchemes,
107
109
  info: {
108
110
  ...openapiData.info,
109
- tags: (_b = openapiData.tags) === null || _b === void 0 ? void 0 : _b.map((tagName) => { var _a; return getTagDisplayName(tagName.name, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []); }),
110
- title: (_c = openapiData.info.title) !== null && _c !== void 0 ? _c : "Introduction",
111
+ tags: (_c = openapiData.tags) === null || _c === void 0 ? void 0 : _c.map((tagName) => { var _a; return getTagDisplayName(tagName.name, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []); }),
112
+ title: (_d = openapiData.info.title) !== null && _d !== void 0 ? _d : "Introduction",
111
113
  },
112
114
  };
113
115
  items.push(infoPage);
@@ -115,16 +117,16 @@ function createItems(openapiData, sidebarOptions) {
115
117
  for (let [path, pathObject] of Object.entries(openapiData.paths)) {
116
118
  const { $ref, description, parameters, servers, summary, ...rest } = pathObject;
117
119
  for (let [method, operationObject] of Object.entries({ ...rest })) {
118
- const title = (_e = (_d = operationObject.summary) !== null && _d !== void 0 ? _d : operationObject.operationId) !== null && _e !== void 0 ? _e : "Missing summary";
120
+ const title = (_f = (_e = operationObject.summary) !== null && _e !== void 0 ? _e : operationObject.operationId) !== null && _f !== void 0 ? _f : "Missing summary";
119
121
  if (operationObject.description === undefined) {
120
122
  operationObject.description =
121
- (_g = (_f = operationObject.summary) !== null && _f !== void 0 ? _f : operationObject.operationId) !== null && _g !== void 0 ? _g : "";
123
+ (_h = (_g = operationObject.summary) !== null && _g !== void 0 ? _g : operationObject.operationId) !== null && _h !== void 0 ? _h : "";
122
124
  }
123
125
  const baseId = (0, lodash_1.kebabCase)(title);
124
- const servers = (_j = (_h = operationObject.servers) !== null && _h !== void 0 ? _h : pathObject.servers) !== null && _j !== void 0 ? _j : openapiData.servers;
125
- const security = (_k = operationObject.security) !== null && _k !== void 0 ? _k : openapiData.security;
126
+ const servers = (_k = (_j = operationObject.servers) !== null && _j !== void 0 ? _j : pathObject.servers) !== null && _k !== void 0 ? _k : openapiData.servers;
127
+ const security = (_l = operationObject.security) !== null && _l !== void 0 ? _l : openapiData.security;
126
128
  // Add security schemes so we know how to handle security.
127
- const securitySchemes = (_l = openapiData.components) === null || _l === void 0 ? void 0 : _l.securitySchemes;
129
+ const securitySchemes = (_m = openapiData.components) === null || _m === void 0 ? void 0 : _m.securitySchemes;
128
130
  // Make sure schemes are lowercase. See: https://github.com/cloud-annotations/docusaurus-plugin-openapi/issues/79
129
131
  if (securitySchemes) {
130
132
  for (let securityScheme of Object.values(securitySchemes)) {
@@ -134,7 +136,7 @@ function createItems(openapiData, sidebarOptions) {
134
136
  }
135
137
  }
136
138
  let jsonRequestBodyExample;
137
- const body = (_o = (_m = operationObject.requestBody) === null || _m === void 0 ? void 0 : _m.content) === null || _o === void 0 ? void 0 : _o["application/json"];
139
+ const body = (_p = (_o = operationObject.requestBody) === null || _o === void 0 ? void 0 : _o.content) === null || _p === void 0 ? void 0 : _p["application/json"];
138
140
  if (body === null || body === void 0 ? void 0 : body.schema) {
139
141
  jsonRequestBodyExample = (0, createExample_1.sampleFromSchema)(body.schema);
140
142
  }
@@ -143,6 +145,7 @@ function createItems(openapiData, sidebarOptions) {
143
145
  const apiPage = {
144
146
  type: "api",
145
147
  id: baseId,
148
+ infoId: infoId !== null && infoId !== void 0 ? infoId : "",
146
149
  unversionedId: baseId,
147
150
  title: title,
148
151
  description: description !== null && description !== void 0 ? description : "",
@@ -150,7 +153,7 @@ function createItems(openapiData, sidebarOptions) {
150
153
  frontMatter: {},
151
154
  api: {
152
155
  ...defaults,
153
- tags: (_p = operationObject.tags) === null || _p === void 0 ? void 0 : _p.map((tagName) => { var _a; return getTagDisplayName(tagName, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []); }),
156
+ tags: (_q = operationObject.tags) === null || _q === void 0 ? void 0 : _q.map((tagName) => { var _a; return getTagDisplayName(tagName, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []); }),
154
157
  method,
155
158
  path,
156
159
  servers,
@@ -186,29 +189,30 @@ function bindCollectionToApiItems(items, postmanCollection) {
186
189
  });
187
190
  }
188
191
  async function readOpenapiFiles(openapiPath, _options) {
189
- const stat = await fs_extra_1.default.lstat(openapiPath);
190
- if (stat.isDirectory()) {
191
- console.warn(chalk_1.default.yellow("WARNING: Loading a directory of OpenAPI definitions is experimental and subject to unannounced breaking changes."));
192
- // TODO: Add config for inlcude/ignore
193
- const allFiles = await (0, utils_1.Globby)(["**/*.{json,yaml,yml}"], {
194
- cwd: openapiPath,
195
- ignore: utils_1.GlobExcludeDefault,
196
- });
197
- const sources = allFiles.filter((x) => !x.includes("_category_")); // todo: regex exclude?
198
- return Promise.all(sources.map(async (source) => {
199
- // TODO: make a function for this
200
- const fullPath = path_1.default.join(openapiPath, source);
201
- const openapiString = await fs_extra_1.default.readFile(fullPath, "utf-8");
202
- const data = js_yaml_1.default.load(openapiString);
203
- return {
204
- source: fullPath,
205
- sourceDirName: path_1.default.dirname(source),
206
- data,
207
- };
208
- }));
192
+ if (!(0, index_1.isURL)(openapiPath)) {
193
+ const stat = await fs_extra_1.default.lstat(openapiPath);
194
+ if (stat.isDirectory()) {
195
+ console.warn(chalk_1.default.yellow("WARNING: Loading a directory of OpenAPI definitions is experimental and subject to unannounced breaking changes."));
196
+ // TODO: Add config for inlcude/ignore
197
+ const allFiles = await (0, utils_1.Globby)(["**/*.{json,yaml,yml}"], {
198
+ cwd: openapiPath,
199
+ ignore: utils_1.GlobExcludeDefault,
200
+ deep: 1,
201
+ });
202
+ const sources = allFiles.filter((x) => !x.includes("_category_")); // todo: regex exclude?
203
+ return Promise.all(sources.map(async (source) => {
204
+ // TODO: make a function for this
205
+ const fullPath = path_1.default.join(openapiPath, source);
206
+ const data = (await (0, loadAndBundleSpec_1.loadAndBundleSpec)(fullPath));
207
+ return {
208
+ source: fullPath,
209
+ sourceDirName: path_1.default.dirname(source),
210
+ data,
211
+ };
212
+ }));
213
+ }
209
214
  }
210
- const openapiString = await fs_extra_1.default.readFile(openapiPath, "utf-8");
211
- const data = js_yaml_1.default.load(openapiString);
215
+ const data = (await (0, loadAndBundleSpec_1.loadAndBundleSpec)(openapiPath));
212
216
  return [
213
217
  {
214
218
  source: openapiPath,
@@ -22,12 +22,6 @@ describe("openapi", () => {
22
22
  const yaml = results.find((x) => x.source.endsWith("openapi.yaml"));
23
23
  expect(yaml).toBeTruthy();
24
24
  expect(yaml === null || yaml === void 0 ? void 0 : yaml.sourceDirName).toBe(".");
25
- const froyo = results.find((x) => x.source.endsWith("froyo.yaml"));
26
- expect(froyo).toBeTruthy();
27
- expect(froyo === null || froyo === void 0 ? void 0 : froyo.sourceDirName).toBe("yogurtstore");
28
- const nested = results.find((x) => x.source.endsWith("nested.yaml"));
29
- expect(nested).toBeTruthy();
30
- expect(nested === null || nested === void 0 ? void 0 : nested.sourceDirName).toBe("yogurtstore/nested");
31
25
  });
32
26
  });
33
27
  });
@@ -0,0 +1,3 @@
1
+ import { OpenAPISpec } from "./types";
2
+ export declare function loadAndBundleSpec(specUrlOrObject: object | string): Promise<OpenAPISpec>;
3
+ export declare function convertSwagger2OpenAPI(spec: any): Promise<OpenAPISpec>;
@@ -0,0 +1,44 @@
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.convertSwagger2OpenAPI = exports.loadAndBundleSpec = void 0;
10
+ const bundle_1 = require("@redocly/openapi-core/lib/bundle");
11
+ const config_1 = require("@redocly/openapi-core/lib/config/config");
12
+ const swagger2openapi_1 = require("swagger2openapi");
13
+ async function loadAndBundleSpec(specUrlOrObject) {
14
+ const config = new config_1.Config({});
15
+ const bundleOpts = {
16
+ config,
17
+ base: process.cwd(),
18
+ };
19
+ if (typeof specUrlOrObject === "object" && specUrlOrObject !== null) {
20
+ bundleOpts["doc"] = {
21
+ source: { absoluteRef: "" },
22
+ parsed: specUrlOrObject,
23
+ };
24
+ }
25
+ else {
26
+ bundleOpts["ref"] = specUrlOrObject;
27
+ }
28
+ // Force dereference ?
29
+ // bundleOpts["dereference"] = true;
30
+ const { bundle: { parsed }, } = await (0, bundle_1.bundle)(bundleOpts);
31
+ return parsed.swagger !== undefined ? convertSwagger2OpenAPI(parsed) : parsed;
32
+ }
33
+ exports.loadAndBundleSpec = loadAndBundleSpec;
34
+ function convertSwagger2OpenAPI(spec) {
35
+ console.warn("[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0");
36
+ return new Promise((resolve, reject) => (0, swagger2openapi_1.convertObj)(spec, { patch: true, warnOnly: true, text: "{}", anchors: true }, (err, res) => {
37
+ // TODO: log any warnings
38
+ if (err) {
39
+ return reject(err);
40
+ }
41
+ resolve(res && res.openapi);
42
+ }));
43
+ }
44
+ exports.convertSwagger2OpenAPI = convertSwagger2OpenAPI;