Skip to content

Commit

Permalink
fix: cleanup of openapi no context error msg (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gmin2 authored Sep 19, 2024
1 parent 3716f9c commit 5afa8e1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 5afa8e1

Please sign in to comment.