mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Issue with empty roots bundle
This commit is contained in:
@@ -4931,23 +4931,21 @@ module.exports = {
|
||||
try {
|
||||
res.output.data = this.mapProcessRelatedFiles(inputRelatedFiles.rootFiles, inputRelatedFiles.data,
|
||||
inputRelatedFiles.origin, version, inputRelatedFiles.bundleFormat, toBundle);
|
||||
if (res.output.data === undefined || res.output.data.length === 0 ||
|
||||
res.output.data.result === false) {
|
||||
res.result = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof ParseError) {
|
||||
return {
|
||||
result: false,
|
||||
reason: error.message
|
||||
};
|
||||
}
|
||||
else {
|
||||
throw (error);
|
||||
}
|
||||
let newError = new Error('There was an error during the process');
|
||||
newError.stack = error.stack;
|
||||
throw (newError);
|
||||
}
|
||||
if (res.output.data.result === false) {
|
||||
res.result = res.output.data.result;
|
||||
res.error = res.output.data.error;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
@@ -4957,11 +4955,12 @@ module.exports = {
|
||||
/**
|
||||
*
|
||||
* @description Validates the input for multi file APIs
|
||||
* @param {string} processInput - Process input data
|
||||
* @param {object} processInput - Process input data
|
||||
* @param {boolean} bundleProcess - Wheter the process input corresponds to bundel process
|
||||
*
|
||||
* @returns {undefined} - nothing
|
||||
*/
|
||||
validateInputMultiFileAPI(processInput) {
|
||||
validateInputMultiFileAPI(processInput, bundleProcess = false) {
|
||||
if (_.isEmpty(processInput)) {
|
||||
throw new Error('Input object must have "type" and "data" information');
|
||||
}
|
||||
@@ -4974,5 +4973,8 @@ module.exports = {
|
||||
if (processInput.data[0].path === '') {
|
||||
throw new Error('"Path" of the data element should be provided');
|
||||
}
|
||||
if (bundleProcess && (!processInput.rootFiles || processInput.rootFiles.length === 0)) {
|
||||
throw new Error('"RootFiles" parameter should be provided');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user