Skip to content

Commit

Permalink
feat: support 2.6.0 version (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmatatjahu authored Feb 2, 2023
1 parent 2326ccf commit 8f2c37b
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 174 deletions.
8 changes: 7 additions & 1 deletion src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ import type { AsyncAPIDocument, ConvertVersion, ConvertOptions } from './interfa
'2.3.0': from__2_2_0__to__2_3_0,
'2.4.0': from__2_3_0__to__2_4_0,
'2.5.0': from__2_4_0__to__2_5_0,
'2.6.0': from__2_5_0__to__2_6_0,
};
const conversionVersions = Object.keys(conversions);

export function convert(asyncapi: string, version?: ConvertVersion, options?: ConvertOptions): string;
export function convert(asyncapi: AsyncAPIDocument, version?: ConvertVersion, options?: ConvertOptions): AsyncAPIDocument;
export function convert(asyncapi: string | AsyncAPIDocument, version: ConvertVersion = '2.5.0', options: ConvertOptions = {}): string | AsyncAPIDocument {
export function convert(asyncapi: string | AsyncAPIDocument, version: ConvertVersion = '2.6.0', options: ConvertOptions = {}): string | AsyncAPIDocument {
const { format, document } = serializeInput(asyncapi);

const asyncapiVersion = document.asyncapi;
Expand Down Expand Up @@ -222,3 +223,8 @@ function from__2_4_0__to__2_5_0(asyncapi: AsyncAPIDocument, _: ConvertOptions) {
asyncapi.asyncapi = '2.5.0';
return asyncapi;
}

function from__2_5_0__to__2_6_0(asyncapi: AsyncAPIDocument, _: ConvertOptions) {
asyncapi.asyncapi = '2.6.0';
return asyncapi;
}
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export type AsyncAPIDocument = { asyncapi: string } & Record<string, any>;
export type ConvertVersion = '1.1.0' | '1.2.0' | '2.0.0-rc1' | '2.0.0-rc2' | '2.0.0' | '2.1.0' | '2.2.0' | '2.3.0' | '2.4.0' | '2.5.0';
export type ConvertVersion = '1.1.0' | '1.2.0' | '2.0.0-rc1' | '2.0.0-rc2' | '2.0.0' | '2.1.0' | '2.2.0' | '2.3.0' | '2.4.0' | '2.5.0' | '2.6.0';
export interface ConvertOptions {}
Loading

0 comments on commit 8f2c37b

Please sign in to comment.