diff --git a/lib/commands/smapi/cli-customization-processor.js b/lib/commands/smapi/cli-customization-processor.js index 7feec784..4d4c32d2 100644 --- a/lib/commands/smapi/cli-customization-processor.js +++ b/lib/commands/smapi/cli-customization-processor.js @@ -32,6 +32,10 @@ class CliCustomizationProcessor { * @param {Map} definitions Map with all Swagger definitions. */ processParameter(parameter, parentOperation, definitions) { + const customization = customizationMap.get(parameter.name) || {}; + parameter.skip = customization.skip || false; + if (parameter.skip) return; + if (parameter.in === 'body') { this._processBodyParameter(parameter, parentOperation, definitions); } else { diff --git a/lib/commands/smapi/customizations/hook-functions/append-vendor-id.js b/lib/commands/smapi/customizations/hook-functions/append-vendor-id.js index 233a062a..9cff70d0 100644 --- a/lib/commands/smapi/customizations/hook-functions/append-vendor-id.js +++ b/lib/commands/smapi/customizations/hook-functions/append-vendor-id.js @@ -8,9 +8,9 @@ const appendVendorId = (requestParameters, profile) => { const { createSkillRequest, createInSkillProductRequest } = requestParameters; const body = createSkillRequest || createInSkillProductRequest; const vendorId = AppConfig.getInstance().getVendorId(profile); - if (body && !body.vendorId) { + if (body) { body.vendorId = vendorId; - } else if (!requestParameters.vendorId) { + } else { requestParameters.vendorId = vendorId; } }; diff --git a/lib/commands/smapi/customizations/parameters.json b/lib/commands/smapi/customizations/parameters.json index e41c5d4a..7253ae22 100644 --- a/lib/commands/smapi/customizations/parameters.json +++ b/lib/commands/smapi/customizations/parameters.json @@ -2,6 +2,9 @@ "stageV2": { "name": "stage" }, + "vendorId": { + "skip": true + }, "createSkillRequest": { "skipUnwrap": true, "name": "manifest" diff --git a/test/unit/commands/smapi/cli-customization-processor-test.js b/test/unit/commands/smapi/cli-customization-processor-test.js index e8123602..a4319b31 100644 --- a/test/unit/commands/smapi/cli-customization-processor-test.js +++ b/test/unit/commands/smapi/cli-customization-processor-test.js @@ -96,6 +96,17 @@ describe('Smapi test - CliCustomizationProcessor class', () => { expect(flatParamsMap.get(key)).eql(expected); }); + it('| should skip processing of parameter', () => { + const parameter = makeParameter(); + const skip = true; + + sinon.stub(customizationMap, 'get').returns({ skip }); + + processor.processParameter(parameter, parentOperation, definitions); + + expect(parameter.skip).eql(true); + }); + it('| should add simple array of non body paramter', () => { const parameter = makeParameter({ type: 'array' }); diff --git a/test/unit/commands/smapi/hook-functions/append-vendor-id-test.js b/test/unit/commands/smapi/hook-functions/append-vendor-id-test.js index 01e782c9..a6ec3f6c 100644 --- a/test/unit/commands/smapi/hook-functions/append-vendor-id-test.js +++ b/test/unit/commands/smapi/hook-functions/append-vendor-id-test.js @@ -38,15 +38,6 @@ describe('Smapi hook functions test - appendVendorId tests', () => { expect(requestParameters.vendorId).eql(vendorId); }); - it('| should not append vendor id to requestParameters if already exists', () => { - const existingVendorId = 'some existing vendor id'; - const requestParameters = { vendorId: existingVendorId }; - - appendVendorId(requestParameters, profile); - - expect(requestParameters.vendorId).eql(existingVendorId); - }); - afterEach(() => { sinon.restore(); });