From 5afa8e1434d97bd7a6570c996efd0540a968e193 Mon Sep 17 00:00:00 2001 From: Mintu Gogoi <127925465+Gmin2@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:02:09 +0530 Subject: [PATCH] fix: cleanup of openapi no context error msg (#280) --- src/convert.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/convert.ts b/src/convert.ts index cf1e0cdd..0d19ac69 100644 --- a/src/convert.ts +++ b/src/convert.ts @@ -26,10 +26,6 @@ export function convert(input: AsyncAPIDocument, version: AsyncAPIConvertVersion export function convert(input: string | AsyncAPIDocument, version: AsyncAPIConvertVersion , options: ConvertOptions= {}): string | AsyncAPIDocument { const { format, document } = serializeInput(input); - if ('openapi' in document) { - throw new Error('Cannot convert OpenAPI document. Use convertOpenAPI function instead.'); - } - const asyncapiVersion = document.asyncapi; let fromVersion = conversionVersions.indexOf(asyncapiVersion); const toVersion = conversionVersions.indexOf(version); @@ -46,7 +42,7 @@ export function convert(input: string | AsyncAPIDocument, version: AsyncAPIConve // add 1 to `fromVersion` because we convert from previous to next fromVersion++; - let converted = document; + let converted = document as AsyncAPIDocument; for (let i = fromVersion; i <= toVersion; i++) { const v = conversionVersions[i] as AsyncAPIConvertVersion; converted = asyncAPIconverters[v](converted, options);