diff --git a/lib/schemaUtils.js b/lib/schemaUtils.js index b962f6e..4171774 100644 --- a/lib/schemaUtils.js +++ b/lib/schemaUtils.js @@ -418,7 +418,7 @@ module.exports = { _.forOwn(serverVariables, (value, key) => { let description = this.getParameterDescription(value); variables.push(new sdk.Variable({ - id: key, + key: key, value: value.default || '', description: description })); @@ -426,7 +426,7 @@ module.exports = { } if (keyName) { variables.push(new sdk.Variable({ - id: keyName, + key: keyName, value: serverUrl, type: 'string' })); @@ -2128,7 +2128,7 @@ module.exports = { convertedPathVar = _.get(this.convertParamsWithStyle(element, fakedData, PARAMETER_SOURCE.REQUEST, components, schemaCache, options), '[0]', {}); - variableStore[element.name] = _.assign(convertedPathVar, { id: element.name, type: 'collection' }); + variableStore[element.name] = _.assign(convertedPathVar, { key: element.name, type: 'collection' }); } }); // accounting for the overriding of the root level and path level servers object if present at the operation level @@ -2159,7 +2159,7 @@ module.exports = { sanitizeResult.collectionVars.forEach((element) => { if (!variableStore[element.name]) { variableStore[element.name] = { - id: element.name, + key: element.name, value: element.value || '', description: element.description, type: 'collection' diff --git a/test/unit/base.test.js b/test/unit/base.test.js index 45fe917..21c8d9c 100644 --- a/test/unit/base.test.js +++ b/test/unit/base.test.js @@ -144,14 +144,14 @@ describe('CONVERT FUNCTION TESTS ', function() { expect(conversionResult.output[0].data).to.have.property('item'); expect(conversionResult.output[0].data).to.have.property('variable'); expect(conversionResult.output[0].data.variable).to.be.an('array'); - expect(conversionResult.output[0].data.variable[1].id).to.equal('format'); + expect(conversionResult.output[0].data.variable[1].key).to.equal('format'); expect(conversionResult.output[0].data.variable[1].value).to.equal('json'); - expect(conversionResult.output[0].data.variable[2].id).to.equal('path'); + expect(conversionResult.output[0].data.variable[2].key).to.equal('path'); expect(conversionResult.output[0].data.variable[2].value).to.equal('send-email'); - expect(conversionResult.output[0].data.variable[3].id).to.equal('new-path-variable-1'); + expect(conversionResult.output[0].data.variable[3].key).to.equal('new-path-variable-1'); // serialised value for object { R: 100, G: 200, B: 150 } expect(conversionResult.output[0].data.variable[3].value).to.equal('R,100,G,200,B,150'); - expect(conversionResult.output[0].data.variable[4].id).to.equal('new-path-variable-2'); + expect(conversionResult.output[0].data.variable[4].key).to.equal('new-path-variable-2'); // serialised value for array ["exampleString", "exampleString"] expect(conversionResult.output[0].data.variable[4].value).to.equal('exampleString,exampleString'); done(); @@ -902,8 +902,8 @@ describe('CONVERT FUNCTION TESTS ', function() { requestUrl = conversionResult.output[0].data.item[0].request.url; collectionVars = conversionResult.output[0].data.variable; expect(requestUrl.host).to.eql(['{{baseUrl}}']); - expect(_.find(collectionVars, { id: 'baseUrl' }).value).to.eql('{{BASE_URI}}/api'); - expect(_.find(collectionVars, { id: 'BASE_URI' }).value).to.eql('https://api.example.com'); + expect(_.find(collectionVars, { key: 'baseUrl' }).value).to.eql('{{BASE_URI}}/api'); + expect(_.find(collectionVars, { key: 'BASE_URI' }).value).to.eql('https://api.example.com'); done(); }); }); diff --git a/test/unit/util.test.js b/test/unit/util.test.js index 913f580..b0964fb 100644 --- a/test/unit/util.test.js +++ b/test/unit/util.test.js @@ -231,7 +231,7 @@ describe('SCHEMA UTILITY FUNCTION TESTS ', function () { }, retVal = SchemaUtils.convertToPmCollectionVariables(serverVariables, null, null); expect(retVal).to.be.an('array'); - expect(retVal[0].id).to.equal('v1'); + expect(retVal[0].key).to.equal('v1'); expect(retVal[0].value).to.equal('v2.0'); }); @@ -249,9 +249,9 @@ describe('SCHEMA UTILITY FUNCTION TESTS ', function () { expect(retVal).to.be.an('array'); - expect(retVal[0].id).to.equal('v1'); + expect(retVal[0].key).to.equal('v1'); expect(retVal[0].value).to.equal('v2.0'); - expect(retVal[1].id).to.equal('baseUrl'); + expect(retVal[1].key).to.equal('baseUrl'); expect(retVal[1].value).to.equal('hello.com'); }); });