Merge branch 'split/develop/multiFileSupport' into fix/formatForEachroot

This commit is contained in:
Luis Tejeda
2022-06-09 11:50:38 -05:00
30 changed files with 1173 additions and 193 deletions

View File

@@ -92,7 +92,7 @@ const { formatDataPath, checkIsCorrectType, isKnownType } = require('./common/sc
{ getRelatedFiles } = require('./relatedFiles'),
{ compareVersion } = require('./common/versionUtils.js'),
parse = require('./parse'),
{ getBundleContentAndComponents } = require('./bundle.js'),
{ getBundleContentAndComponents, parseFileOrThrow } = require('./bundle.js'),
MULTI_FILE_API_TYPE_ALLOWED_VALUE = 'multiFile';
/* eslint-enable */
@@ -4901,7 +4901,7 @@ module.exports = {
mapProcessRelatedFiles(rootFiles, inputData, origin, version, format, toBundle = false) {
let bundleFormat = format,
parsedRootFiles = rootFiles.map((rootFile) => {
let parsedContent = this.parseFileOrThrow(rootFile.content);
let parsedContent = parseFileOrThrow(rootFile.content);
return { fileName: rootFile.fileName, content: rootFile.content, parsed: parsedContent };
}).filter((rootWithParsedContent) => {
// bundleFormat = bundleFormat ? bundleFormat : rootWithParsedContent.parsed.inputFormat;
@@ -4985,13 +4985,5 @@ module.exports = {
throw new Error('"Path" of the data element should be provided');
}
},
parseFileOrThrow(fileContent) {
const result = parse.getOasObject(fileContent);
if (result.result === false) {
throw new ParseError(result.reason);
}
return result;
},
MULTI_FILE_API_TYPE_ALLOWED_VALUE
};