From bc65e26b7e580d40305c5f7a3cb21d8eb78d6e24 Mon Sep 17 00:00:00 2001 From: Claudia Ma Date: Mon, 19 Feb 2024 12:02:06 -0800 Subject: [PATCH 1/2] Adding migration files --- docs/migration/migrating-to-v3.md | 79 +++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 docs/migration/migrating-to-v3.md diff --git a/docs/migration/migrating-to-v3.md b/docs/migration/migrating-to-v3.md new file mode 100644 index 0000000..cf6592a --- /dev/null +++ b/docs/migration/migrating-to-v3.md @@ -0,0 +1,79 @@ +--- +title: "Migrating to v3" +--- + +To provide as smooth a transition as possible, this document shows the breaking changes between AsyncAPI Parser API v2.0.0 and v3.0.0 in an interactive manner. + +The changes from v2 to v3 are reflected in `Message` and `MessageTrait` objects. + + +## Replaced `messageId` with `id` + +Since `id()` already represents that the message has an ID, `messageId()` is redundent in terms of the purpose. + +```md +# AsyncAPI Parser API v2.0.0 +... +## Message +- id(): `string` +- hasMessageId(): `boolean` +- messageId(): `string` | `undefined` +... +## MessageTrait +- id(): `string` +- hasMessageId(): `boolean` +- messageId(): `string` | `undefined` +``` + +```md +# AsyncAPI Parser API v3.0.0 +... +## Message +- id(): `string` +- hasMessageId(): `boolean` +... +## MessageTrait +- id(): `string` +- hasMessageId(): `boolean` +``` + + +------------------------------ + + + +## Changed Return Types for `schemaFormat` + +In v2, the return type of `schemaFormat()` in `Message` and `MessageTrait` objects is only defined as `string`. + + + +```md +# AsyncAPI Parser API v2.0.0 +... +## Message +- id(): `string` +- hasSchemaFormat(): `boolean` +- schemaFormat(): `string` +... +## MessageTrait +- id(): `string` +- hasSchemaFormat(): `boolean` +- schemaFormat(): `string` +``` + +In v3, the return type has been changed to `string | undefined`, emphasizing that the payload of a message is optional, so it can be undefined as well as be defined as a string. + +```md +# AsyncAPI Parser API v3.0.0 +... +## Message +- id(): `string` +- hasSchemaFormat(): `boolean` +- schemaFormat(): `string` | `undefined` +... +## MessageTrait +- id(): `string` +- hasSchemaFormat(): `boolean` +- schemaFormat(): `string` | `undefined` +``` \ No newline at end of file From 19d72adb60c0b5f47dbd6c0e49bebc886d491d46 Mon Sep 17 00:00:00 2001 From: Claudia Ma Date: Wed, 21 Feb 2024 13:37:32 -0800 Subject: [PATCH 2/2] Update migrating-to-v3.md --- docs/migration/migrating-to-v3.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docs/migration/migrating-to-v3.md b/docs/migration/migrating-to-v3.md index cf6592a..9bbbc27 100644 --- a/docs/migration/migrating-to-v3.md +++ b/docs/migration/migrating-to-v3.md @@ -52,13 +52,9 @@ In v2, the return type of `schemaFormat()` in `Message` and `MessageTrait` objec # AsyncAPI Parser API v2.0.0 ... ## Message -- id(): `string` -- hasSchemaFormat(): `boolean` - schemaFormat(): `string` ... ## MessageTrait -- id(): `string` -- hasSchemaFormat(): `boolean` - schemaFormat(): `string` ``` @@ -68,12 +64,8 @@ In v3, the return type has been changed to `string | undefined`, emphasizing tha # AsyncAPI Parser API v3.0.0 ... ## Message -- id(): `string` -- hasSchemaFormat(): `boolean` - schemaFormat(): `string` | `undefined` ... ## MessageTrait -- id(): `string` -- hasSchemaFormat(): `boolean` - schemaFormat(): `string` | `undefined` ``` \ No newline at end of file