diff --git a/src/interfaces.ts b/src/interfaces.ts index ac6e182b..31aa98a3 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -9,7 +9,6 @@ export type ConvertV2ToV3Options = { useChannelIdExtension?: boolean; convertServerComponents?: boolean; convertChannelComponents?: boolean; - failOnParameterReference?: boolean; } export type ConvertOptions = { v2tov3?: ConvertV2ToV3Options; diff --git a/src/third-version.ts b/src/third-version.ts index 6ec6393f..51980307 100644 --- a/src/third-version.ts +++ b/src/third-version.ts @@ -393,11 +393,7 @@ function convertParameter(parameter: any, options: RequiredConvertV2ToV3Options) } if(parameter.schema?.$ref) { - const errorMessage = 'Could not convert parameter object because the `.schema` property was a reference. This have to be changed manually if you want any of the properties included. The reference was ' + parameter.schema?.$ref; - if(options.failOnParameterReference === true) { - throw new Error(errorMessage); - } - console.error(errorMessage); + console.error('Could not convert parameter object because the `.schema` property was a reference. This have to be changed manually if you want any of the properties included. The reference was ' + parameter.schema?.$ref); } const enumValues = parameter.schema?.enum ?? null; diff --git a/test/second-to-third-version.spec.ts b/test/second-to-third-version.spec.ts index 44a00c64..32de63e4 100644 --- a/test/second-to-third-version.spec.ts +++ b/test/second-to-third-version.spec.ts @@ -33,15 +33,10 @@ describe('convert() - 2.X.X to 3.X.X versions', () => { assertResults(output, result); }); - it('should throw exception when parameter encountered with failOnParameterReference=true', () => { - const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0-with-reference-parameter.yml'), 'utf8'); - expect(() => {convert(input, '3.0.0', {v2tov3: {failOnParameterReference: true}})}).toThrowError('Could not convert parameter object because the `.schema` property was a reference. This have to be changed manually if you want any of the properties included. The reference was #/components/schemas/sentAt'); - }); - it('should handle parameter object', () => { const input = fs.readFileSync(path.resolve(__dirname, 'input', '2.6.0', 'for-3.0.0-with-reference-parameter.yml'), 'utf8'); const output = fs.readFileSync(path.resolve(__dirname, 'output', '3.0.0', 'from-2.6.0-with-reference-parameter.yml'), 'utf8'); - const result = convert(input, '3.0.0', {v2tov3: {failOnParameterReference: false}}); + const result = convert(input, '3.0.0'); assertResults(output, result); }); });