Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adding migration guides #107

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions docs/migration/migrating-to-v3.md
Original file line number Diff line number Diff line change
@@ -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`
RegretfulWinter marked this conversation as resolved.
Show resolved Hide resolved
- schemaFormat(): `string`
...
## MessageTrait
- id(): `string`
- hasSchemaFormat(): `boolean`
RegretfulWinter marked this conversation as resolved.
Show resolved Hide resolved
- 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`
RegretfulWinter marked this conversation as resolved.
Show resolved Hide resolved
- schemaFormat(): `string` | `undefined`
...
## MessageTrait
- id(): `string`
- hasSchemaFormat(): `boolean`
RegretfulWinter marked this conversation as resolved.
Show resolved Hide resolved
- schemaFormat(): `string` | `undefined`
```
Loading