mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Folder for multifile and multi data res
Change the use of folder and now use multiFile as option type value. Return a JS object instead of a json string return a data array in response
This commit is contained in:
@@ -167,7 +167,7 @@ function getSpecVersion({ type, data, specificationVersion }) {
|
||||
return DEFAULT_SPEC_VERSION;
|
||||
}
|
||||
|
||||
if (['folder'].includes(type)) {
|
||||
if (['folder', 'multiFile'].includes(type)) {
|
||||
data = getFileWithVersion(data, specificationVersion);
|
||||
}
|
||||
else if (['file'].includes(type)) {
|
||||
|
||||
@@ -4854,15 +4854,17 @@ module.exports = {
|
||||
let bundleData = getBundleContentAndComponents(root, inputData, origin);
|
||||
return bundleData;
|
||||
});
|
||||
let bundledFile = data[0].fileContent;
|
||||
bundledFile.components = data[0].components;
|
||||
if (format === parse.YAML_FORMAT) {
|
||||
bundledFile = parse.toYAML(bundledFile);
|
||||
}
|
||||
else if (format === parse.JSON_FORMAT) {
|
||||
bundledFile = parse.toJSON(bundledFile, 2);
|
||||
}
|
||||
return { rootFile: { path: parsedRootFiles[0].fileName }, bundledContent: bundledFile };
|
||||
|
||||
let bundleData = data.map((contentAndComponents) => {
|
||||
let bundledFile = contentAndComponents.fileContent;
|
||||
bundledFile.components = contentAndComponents.components;
|
||||
if (format === parse.YAML_FORMAT) {
|
||||
bundledFile = parse.toYAML(bundledFile);
|
||||
}
|
||||
return { rootFile: { path: parsedRootFiles[0].fileName }, bundledContent: bundledFile };
|
||||
});
|
||||
|
||||
return bundleData;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,11 +31,10 @@ const COLLECTION_NAME = 'Imported from OpenAPI 3.0',
|
||||
let path = require('path'),
|
||||
concreteUtils,
|
||||
pathBrowserify = require('path-browserify');
|
||||
// traverseUtility = require('traverse');
|
||||
|
||||
class SchemaPack {
|
||||
constructor (input, options = {}) {
|
||||
if (input.type === 'folder' && input.data && input.data[0] && input.data[0].path) {
|
||||
if (input.type === 'multiFile' && input.data && input.data[0] && input.data[0].path) {
|
||||
input = schemaUtils.mapDetectRootFilesInputToFolderInput(input);
|
||||
}
|
||||
this.input = input;
|
||||
|
||||
Reference in New Issue
Block a user