react-query-lightbase-codegen 0.3.0 → 0.5.0
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/cjs/convertSwaggerFile.js +32 -0
- package/lib/cjs/generateHooks.js +401 -0
- package/lib/cjs/generateImports.js +31 -0
- package/lib/cjs/generateRequestBodiesDefinition.js +36 -0
- package/lib/cjs/generateResponsesDefinition.js +36 -0
- package/lib/cjs/generateSchemas.js +103 -0
- package/lib/cjs/generateSchemasDefinition.js +40 -0
- package/lib/cjs/getResReqTypes.js +162 -0
- package/lib/cjs/import-open-api.js +10 -1005
- package/lib/cjs/importSpecs.js +87 -0
- package/lib/cjs/index.js +5 -3
- package/lib/cjs/react-query-codegen-import.js +20 -12
- package/lib/cjs/resolveDiscriminator.js +31 -0
- package/lib/cjs/utils.js +168 -0
- package/lib/esm/convertSwaggerFile.js +25 -0
- package/lib/esm/generateHooks.js +394 -0
- package/lib/esm/generateImports.js +27 -0
- package/lib/esm/generateRequestBodiesDefinition.js +29 -0
- package/lib/esm/generateResponsesDefinition.js +29 -0
- package/lib/esm/generateSchemas.js +96 -0
- package/lib/esm/generateSchemasDefinition.js +33 -0
- package/lib/esm/getResReqTypes.js +150 -0
- package/lib/esm/import-open-api.js +8 -988
- package/lib/esm/importSpecs.js +80 -0
- package/lib/esm/index.js +3 -2
- package/lib/esm/react-query-codegen-import.js +21 -13
- package/lib/esm/resolveDiscriminator.js +24 -0
- package/lib/esm/utils.js +156 -0
- package/package.json +17 -15
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.importSpecs = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const convertSwaggerFile_js_1 = require("./convertSwaggerFile.js");
|
|
11
|
+
const generateHooks_js_1 = require("./generateHooks.js");
|
|
12
|
+
const generateImports_js_1 = require("./generateImports.js");
|
|
13
|
+
const generateSchemas_js_1 = require("./generateSchemas.js");
|
|
14
|
+
function importSpecs({ sourceDirectory, exportDirectory, apiDirectory, queryClientDir, headerFilters, overrides, }) {
|
|
15
|
+
(0, fs_1.readdir)(sourceDirectory, function (err, filenames) {
|
|
16
|
+
if (err) {
|
|
17
|
+
console.log(err);
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
filenames.map(async (filename) => {
|
|
21
|
+
try {
|
|
22
|
+
const data = (0, fs_1.readFileSync)((0, path_1.join)(process.cwd(), sourceDirectory + '/' + filename), 'utf-8');
|
|
23
|
+
const { ext } = (0, path_1.parse)(sourceDirectory + '/' + filename);
|
|
24
|
+
const format = ['.yaml', '.yml'].includes(ext.toLowerCase()) ? 'yaml' : 'json';
|
|
25
|
+
let spec = await (0, convertSwaggerFile_js_1.convertSwaggerFile)(data, format);
|
|
26
|
+
const schemaName = `useQueries${filename.split('.')[0]}.schema`;
|
|
27
|
+
const hooksName = `useQueries${filename.split('.')[0]}`;
|
|
28
|
+
const name = filename.split('.')[0];
|
|
29
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}`), { recursive: true });
|
|
30
|
+
const operationIds = [];
|
|
31
|
+
let hooks = '';
|
|
32
|
+
let schemaImportsArray = [];
|
|
33
|
+
let collectedQueryImports = [];
|
|
34
|
+
Object.entries(spec.paths).forEach(([route, verbs]) => {
|
|
35
|
+
Object.entries(verbs).forEach(([verb, operation]) => {
|
|
36
|
+
if (['get', 'post', 'patch', 'put', 'delete'].includes(verb) && !operation.deprecated) {
|
|
37
|
+
const { implementation, imports, queryImports } = (0, generateHooks_js_1.createHook)({
|
|
38
|
+
operation,
|
|
39
|
+
verb,
|
|
40
|
+
route: (spec.basePath || '') + route,
|
|
41
|
+
operationIds,
|
|
42
|
+
parameters: verbs.parameters,
|
|
43
|
+
schemasComponents: spec.components,
|
|
44
|
+
headerFilters,
|
|
45
|
+
overrides,
|
|
46
|
+
});
|
|
47
|
+
hooks += implementation;
|
|
48
|
+
imports.forEach((element) => {
|
|
49
|
+
const formattedImport = element.replace('[]', '');
|
|
50
|
+
if (!schemaImportsArray.includes(formattedImport) &&
|
|
51
|
+
element !== 'void' &&
|
|
52
|
+
element !== 'string' &&
|
|
53
|
+
!element.includes('{')) {
|
|
54
|
+
schemaImportsArray.push(formattedImport);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
queryImports.forEach((element) => {
|
|
58
|
+
if (!schemaImportsArray.includes(element)) {
|
|
59
|
+
collectedQueryImports.push(element);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
const imports = (0, generateImports_js_1.generateImports)({
|
|
66
|
+
apiDirectory,
|
|
67
|
+
queryClientDir,
|
|
68
|
+
schemaName,
|
|
69
|
+
schemaImports: schemaImportsArray,
|
|
70
|
+
queryImports: collectedQueryImports,
|
|
71
|
+
});
|
|
72
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}/${hooksName}.tsx`), imports + hooks);
|
|
73
|
+
const schemas = (0, generateSchemas_js_1.generateSchemas)({ spec });
|
|
74
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}/${schemaName}.tsx`), schemas);
|
|
75
|
+
console.log(chalk_1.default.green(`🎉 [${filename}] Your OpenAPI spec has been converted into react query hooks`));
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error.code === 'EISDIR') {
|
|
79
|
+
console.log(chalk_1.default.red('nested folder structure not supported'));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
console.log(chalk_1.default.red(`[${filename}]:`), chalk_1.default.red(error));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.importSpecs = importSpecs;
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.importSpecs = void 0;
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.convertSwaggerFile = exports.importSpecs = void 0;
|
|
4
|
+
const convertSwaggerFile_js_1 = require("./convertSwaggerFile.js");
|
|
5
|
+
Object.defineProperty(exports, "convertSwaggerFile", { enumerable: true, get: function () { return convertSwaggerFile_js_1.convertSwaggerFile; } });
|
|
6
|
+
const importSpecs_js_1 = require("./importSpecs.js");
|
|
7
|
+
Object.defineProperty(exports, "importSpecs", { enumerable: true, get: function () { return importSpecs_js_1.importSpecs; } });
|
|
@@ -7,12 +7,13 @@ exports.importSpecs = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = require("path");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
10
|
+
const convertSwaggerFile_1 = require("./convertSwaggerFile");
|
|
11
|
+
const generateHooks_1 = require("./generateHooks");
|
|
12
|
+
const generateSchemas_1 = require("./generateSchemas");
|
|
13
13
|
function importSpecs({ sourceDirectory, exportDirectory, apiDirectory, queryClientDir, headerFilters, }) {
|
|
14
14
|
(0, fs_1.readdir)(sourceDirectory, function (err, filenames) {
|
|
15
15
|
if (err) {
|
|
16
|
+
console.log(err);
|
|
16
17
|
throw err;
|
|
17
18
|
}
|
|
18
19
|
filenames.map(async (filename) => {
|
|
@@ -20,20 +21,27 @@ function importSpecs({ sourceDirectory, exportDirectory, apiDirectory, queryClie
|
|
|
20
21
|
const { ext } = (0, path_1.parse)(sourceDirectory + '/' + filename);
|
|
21
22
|
const format = ['.yaml', '.yml'].includes(ext.toLowerCase()) ? 'yaml' : 'json';
|
|
22
23
|
try {
|
|
23
|
-
const name =
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const name = filename.split('.')[0];
|
|
25
|
+
const hooksName = `useQueries${filename.split('.')[0]}`;
|
|
26
|
+
const schemaName = `useQueries${filename.split('.')[0]}.schema`;
|
|
27
|
+
let spec = await (0, convertSwaggerFile_1.convertSwaggerFile)(data, format);
|
|
28
|
+
const operationIds = [];
|
|
29
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}`), { recursive: true });
|
|
30
|
+
const hooks = (0, generateHooks_1.generateQueryHooks)({
|
|
31
|
+
spec,
|
|
32
|
+
schemaName,
|
|
33
|
+
operationIds,
|
|
28
34
|
headerFilters,
|
|
35
|
+
apiDirectory,
|
|
29
36
|
queryClientDir,
|
|
30
37
|
});
|
|
31
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}`),
|
|
32
|
-
|
|
38
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}/${hooksName}.tsx`), hooks);
|
|
39
|
+
const schemas = (0, generateSchemas_1.generateSchemas)(spec);
|
|
40
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}/${schemaName}.tsx`), schemas);
|
|
41
|
+
console.log(chalk_1.default.green(`🎉 [${filename}] Your OpenAPI spec has been converted into react query hooks`));
|
|
33
42
|
}
|
|
34
43
|
catch (error) {
|
|
35
|
-
log(chalk_1.default.red(`[${filename}]:`), chalk_1.default.red(error));
|
|
36
|
-
// process.exit(1);
|
|
44
|
+
console.log(chalk_1.default.red(`[${filename}]:`), chalk_1.default.red(error));
|
|
37
45
|
}
|
|
38
46
|
});
|
|
39
47
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveDiscriminator = void 0;
|
|
7
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
8
|
+
const getResReqTypes_1 = require("./getResReqTypes");
|
|
9
|
+
/**
|
|
10
|
+
* Propagate every `discriminator.propertyName` mapping to the original ref
|
|
11
|
+
*
|
|
12
|
+
* Note: This method directly mutate the `specs` object.
|
|
13
|
+
*/
|
|
14
|
+
const resolveDiscriminator = (specs) => {
|
|
15
|
+
if (specs.components && specs.components.schemas) {
|
|
16
|
+
Object.values(specs.components.schemas).forEach((schema) => {
|
|
17
|
+
if ((0, getResReqTypes_1.isReference)(schema) || !schema.discriminator || !schema.discriminator.mapping) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const { mapping, propertyName } = schema.discriminator;
|
|
21
|
+
Object.entries(mapping).forEach(([name, ref]) => {
|
|
22
|
+
if (!ref.startsWith('#/components/schemas/')) {
|
|
23
|
+
throw new Error('Discriminator mapping outside of `#/components/schemas` is not supported');
|
|
24
|
+
}
|
|
25
|
+
console.log('HELLO');
|
|
26
|
+
(0, set_1.default)(specs, `components.schemas.${ref.slice('#/components/schemas/'.length)}.properties.${propertyName}.enum`, [name]);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.resolveDiscriminator = resolveDiscriminator;
|
package/lib/cjs/utils.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getResReqTypes = exports.formatDescription = exports.resolveValue = exports.getScalar = exports.isReference = exports.getDocs = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const { uniq, isEmpty } = lodash_1.default;
|
|
9
|
+
const case_1 = __importDefault(require("case"));
|
|
10
|
+
const { pascal } = case_1.default;
|
|
11
|
+
const getDocs = (data) => (0, exports.isReference)(data) ? '' : (0, exports.formatDescription)(data.description);
|
|
12
|
+
exports.getDocs = getDocs;
|
|
13
|
+
/**
|
|
14
|
+
* Discriminator helper for `ReferenceObject`
|
|
15
|
+
*/
|
|
16
|
+
const isReference = (property) => {
|
|
17
|
+
return Boolean(property.$ref);
|
|
18
|
+
};
|
|
19
|
+
exports.isReference = isReference;
|
|
20
|
+
/**
|
|
21
|
+
* Return the typescript equivalent of open-api data type
|
|
22
|
+
*/
|
|
23
|
+
const getScalar = (item) => {
|
|
24
|
+
const nullable = item.nullable ? ' | null' : '';
|
|
25
|
+
switch (item.type) {
|
|
26
|
+
case 'number':
|
|
27
|
+
case 'integer':
|
|
28
|
+
return 'number' + nullable;
|
|
29
|
+
case 'boolean':
|
|
30
|
+
return 'boolean' + nullable;
|
|
31
|
+
case 'array':
|
|
32
|
+
return getArray(item) + nullable;
|
|
33
|
+
case 'string':
|
|
34
|
+
return (item.enum ? `"${item.enum.join(`" | "`)}"` : 'string') + nullable;
|
|
35
|
+
case 'object':
|
|
36
|
+
default:
|
|
37
|
+
return getObject(item) + nullable;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.getScalar = getScalar;
|
|
41
|
+
/**
|
|
42
|
+
* Return the output type from the $ref
|
|
43
|
+
*/
|
|
44
|
+
const getRef = ($ref) => {
|
|
45
|
+
if ($ref.startsWith('#/components/schemas')) {
|
|
46
|
+
return pascal($ref.replace('#/components/schemas/', ''));
|
|
47
|
+
}
|
|
48
|
+
else if ($ref.startsWith('#/components/responses')) {
|
|
49
|
+
return pascal($ref.replace('#/components/responses/', '')) + 'Response';
|
|
50
|
+
}
|
|
51
|
+
else if ($ref.startsWith('#/components/parameters')) {
|
|
52
|
+
return pascal($ref.replace('#/components/parameters/', '')) + 'Parameter';
|
|
53
|
+
}
|
|
54
|
+
else if ($ref.startsWith('#/components/requestBodies')) {
|
|
55
|
+
return pascal($ref.replace('#/components/requestBodies/', '')) + 'RequestBody';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error('This library only resolve $ref that are include into `#/components/*` for now');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Return the output type from an array
|
|
63
|
+
*/
|
|
64
|
+
const getArray = (item) => {
|
|
65
|
+
if (item.items) {
|
|
66
|
+
if (!(0, exports.isReference)(item.items) && (item.items.oneOf || item.items.allOf || item.items.enum)) {
|
|
67
|
+
return `(${(0, exports.resolveValue)(item.items)})[]`;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return `${(0, exports.resolveValue)(item.items)}[]`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new Error('All arrays must have an `items` key define');
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Return the output type from an object
|
|
79
|
+
*/
|
|
80
|
+
const getObject = (item) => {
|
|
81
|
+
if ((0, exports.isReference)(item)) {
|
|
82
|
+
return getRef(item.$ref);
|
|
83
|
+
}
|
|
84
|
+
if (item.allOf) {
|
|
85
|
+
return item.allOf.map(exports.resolveValue).join(' & ');
|
|
86
|
+
}
|
|
87
|
+
if (item.oneOf) {
|
|
88
|
+
return item.oneOf.map(exports.resolveValue).join(' | ');
|
|
89
|
+
}
|
|
90
|
+
if (!item.type && !item.properties && !item.additionalProperties) {
|
|
91
|
+
return '{}';
|
|
92
|
+
}
|
|
93
|
+
// Free form object (https://swagger.io/docs/specification/data-models/data-types/#free-form)
|
|
94
|
+
if (item.type === 'object' &&
|
|
95
|
+
!item.properties &&
|
|
96
|
+
(!item.additionalProperties || item.additionalProperties === true || isEmpty(item.additionalProperties))) {
|
|
97
|
+
return '{[key: string]: any}';
|
|
98
|
+
}
|
|
99
|
+
const IdentifierRegexp = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
100
|
+
// Consolidation of item.properties & item.additionalProperties
|
|
101
|
+
let output = '{\n';
|
|
102
|
+
if (item.properties) {
|
|
103
|
+
output += Object.entries(item.properties)
|
|
104
|
+
.map(([key, prop]) => {
|
|
105
|
+
const doc = (0, exports.getDocs)(prop);
|
|
106
|
+
const isRequired = (item.required || []).includes(key);
|
|
107
|
+
const processedKey = IdentifierRegexp.test(key) ? key : `"${key}"`;
|
|
108
|
+
return `${doc}\n${processedKey}${isRequired ? '' : '?'}: ${(0, exports.resolveValue)(prop)};`;
|
|
109
|
+
})
|
|
110
|
+
.join('');
|
|
111
|
+
}
|
|
112
|
+
if (item.additionalProperties) {
|
|
113
|
+
if (item.properties) {
|
|
114
|
+
output += '\n';
|
|
115
|
+
}
|
|
116
|
+
output += `} & { [key: string]: ${item.additionalProperties === true ? 'any' : (0, exports.resolveValue)(item.additionalProperties)}`;
|
|
117
|
+
}
|
|
118
|
+
if (item.properties || item.additionalProperties) {
|
|
119
|
+
if (output === '{\n') {
|
|
120
|
+
return '{}';
|
|
121
|
+
}
|
|
122
|
+
return output + '\n}';
|
|
123
|
+
}
|
|
124
|
+
return item.type === 'object' ? '{[key: string]: any}' : 'any';
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Resolve the value of a schema object to a proper type definition.
|
|
128
|
+
*/
|
|
129
|
+
const resolveValue = (schema) => (0, exports.isReference)(schema) ? getRef(schema.$ref) : (0, exports.getScalar)(schema);
|
|
130
|
+
exports.resolveValue = resolveValue;
|
|
131
|
+
/**
|
|
132
|
+
* Format a description to code documentation.
|
|
133
|
+
*/
|
|
134
|
+
const formatDescription = (description) => {
|
|
135
|
+
if (!description) {
|
|
136
|
+
return '';
|
|
137
|
+
}
|
|
138
|
+
return `\n/**\n${description
|
|
139
|
+
.split('\n')
|
|
140
|
+
.map((i) => `* ${i}`)
|
|
141
|
+
.join('\n')}\n */`;
|
|
142
|
+
};
|
|
143
|
+
exports.formatDescription = formatDescription;
|
|
144
|
+
/**
|
|
145
|
+
* Extract responses / request types from open-api specs
|
|
146
|
+
*/
|
|
147
|
+
const getResReqTypes = (responsesOrRequests) => {
|
|
148
|
+
return uniq(responsesOrRequests.map(([_, res]) => {
|
|
149
|
+
if (!res) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if ((0, exports.isReference)(res)) {
|
|
153
|
+
return getRef(res.$ref);
|
|
154
|
+
}
|
|
155
|
+
if (res.content) {
|
|
156
|
+
for (let contentType of Object.keys(res.content)) {
|
|
157
|
+
if (contentType.startsWith('application/json') ||
|
|
158
|
+
contentType.startsWith('application/octet-stream')) {
|
|
159
|
+
const schema = res.content[contentType].schema;
|
|
160
|
+
return (0, exports.resolveValue)(schema);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
return;
|
|
166
|
+
})).join(' | ');
|
|
167
|
+
};
|
|
168
|
+
exports.getResReqTypes = getResReqTypes;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import swagger2openapi from 'swagger2openapi';
|
|
2
|
+
import yaml from 'js-yaml';
|
|
3
|
+
/**
|
|
4
|
+
* Import and parse the openapi spec from a yaml/json
|
|
5
|
+
*/
|
|
6
|
+
export const convertSwaggerFile = (data, extension) => {
|
|
7
|
+
const schema = extension === 'yaml' ? yaml.load(data) : JSON.parse(data);
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
if (!schema.openapi || !schema.openapi.startsWith('3.')) {
|
|
10
|
+
swagger2openapi.convertObj(schema, {}, (err, convertedObj) => {
|
|
11
|
+
if (err) {
|
|
12
|
+
reject(err);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
convertedObj.openapi.basePath = convertedObj.original.basePath;
|
|
17
|
+
resolve(convertedObj.openapi);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
resolve(schema);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|