Fix defintions replacing instead of merging

Fix defintions replacing instead of merging
This commit is contained in:
Luis Tejeda
2022-06-01 14:09:35 -05:00
parent 6fa20ccb48
commit d289dd0fdc
10 changed files with 214 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
const { ParseError } = require('./common/ParseError.js');
const { formatDataPath, checkIsCorrectType, isKnownType } = require('./common/schemaUtilsCommon.js'),
{ getConcreteSchemaUtils } = require('./common/versionUtils.js'),
{ getConcreteSchemaUtils, SWAGGER_VERSION } = require('./common/versionUtils.js'),
async = require('async'),
sdk = require('postman-collection'),
schemaFaker = require('../assets/json-schema-faker.js'),
@@ -4834,7 +4834,7 @@ module.exports = {
return bundleData;
});
let bundledFile = data[0].fileContent;
if (version === '2.0') {
if (version === SWAGGER_VERSION) {
Object.entries(data[0].components).forEach(([key, value]) => {
bundledFile[key] = value;
});
@@ -4870,7 +4870,7 @@ module.exports = {
let parsedContent = this.parseFileOrThrow(rootFile.content);
return { fileName: rootFile.fileName, content: rootFile.content, parsed: parsedContent };
}).filter((rootWithParsedContent) => {
let fileVersion = version === '2.0' ?
let fileVersion = version === SWAGGER_VERSION ?
rootWithParsedContent.parsed.oasObject.swagger :
rootWithParsedContent.parsed.oasObject.openapi;
bundleFormat = bundleFormat ? bundleFormat : rootWithParsedContent.parsed.inputFormat;