diff --git a/components/Asyncapi3Comparison.js b/components/Asyncapi3Comparison.js index e7c0773238a0..cc9c273b3960 100644 --- a/components/Asyncapi3Comparison.js +++ b/components/Asyncapi3Comparison.js @@ -1,174 +1,5 @@ import React, { useState } from 'react'; -/** - * Main comparison that shows the full picture between v2 and v3 - */ -export function Asyncapi3Comparison({ className = '' }) { - const [hoverState, setHoverState] = useState({ - Info: false, - Servers: false, - Paths: false, - PathItem: true, - Summary: false, - Operation: false, - Message: false, - Tags: false, - External: false, - Components: false, - Id: false, - Path: false, - Host: false - }); - - return ( -
-
-

AsyncAPI 2.x

- -
-
setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ Info: false })}> - Info -
-
-
setHoverState(prevState => ({ ...prevState, Tags: true }))} onMouseLeave={() => setHoverState({ Tags: false })}> -

Tags

-
-
setHoverState(prevState => ({ ...prevState, External: true }))} onMouseLeave={() => setHoverState({ External: false })}> -

External Docs

-
-
-
- Servers -
-
- Server -
-
setHoverState(prevState => ({ ...prevState, Host: true, Path: true }))} onMouseLeave={() => setHoverState({ Host: false, Path: false })}> -

Url

-
-
-
-
-
-
setHoverState(prevState => ({ ...prevState, Paths: true }))} onMouseLeave={() => setHoverState({ Paths: false })}> - Channels - -
-
setHoverState(prevState => ({ ...prevState, PathItem: true }))} onMouseLeave={() => setHoverState({ PathItem: false })}> - Channel Item - -
-
setHoverState(prevState => ({ ...prevState, Operation: true }))} onMouseLeave={() => setHoverState({ Operation: false })}> - Operation (Publish and Subscribe) - -
-
-
setHoverState(prevState => ({ ...prevState, Message: true }))} onMouseLeave={() => setHoverState({ Message: false })}> - Messages -
- Message - -
- Headers -
-
- Payload -
-
-
-
-
-
-
-
-
-
-
-
-
-

AsyncAPI 3.0

- -
-
setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ Info: false })}> - Info -
-
setHoverState(prevState => ({ ...prevState, Tags: true }))} onMouseLeave={() => setHoverState({ Tags: false })}> -

Tags

-
-
setHoverState(prevState => ({ ...prevState, External: true }))} onMouseLeave={() => setHoverState({ External: false })}> -

External Docs

-
-
-
-
- Servers -
-
- Server -
-
setHoverState(prevState => ({ ...prevState, Host: true }))} onMouseLeave={() => setHoverState({ Host: false })}> -

Host

-
-
setHoverState(prevState => ({ ...prevState, Path: true }))} onMouseLeave={() => setHoverState({ Path: false })}> -

Pathname

-
-
-
-
-
-
setHoverState(prevState => ({ ...prevState, Paths: true }))} onMouseLeave={() => setHoverState({ Paths: false })}> - Channels - -
setHoverState(prevState => ({ ...prevState, PathItem: true }))} onMouseLeave={() => setHoverState({ PathItem: false })}> - Channel -
-
- address -
-
-
setHoverState(prevState => ({ ...prevState, Message: true }))} onMouseLeave={() => setHoverState({ Message: false })}> - Messages -
- Message - -
- Headers -
-
- Payload -
-
-
-
-
-
-
-
setHoverState(prevState => ({ ...prevState, Operation: true }))} onMouseLeave={() => setHoverState({ Operation: false })}> - Operations -
-
- Operation - -
-
- action (send or receive) -
-
- channel -
-
- messages -
-
-
-
-
-
-
-
- ) -} - /** * Used to compare how channels, operations and messages have changed */ @@ -482,7 +313,8 @@ export function Asyncapi3OperationComparison({ className = '' }) { export function Asyncapi3SchemaFormatComparison({ className = '' }) { const [hoverState, setHoverState] = useState({ SchemaFormat: false, - Payload: false + Payload: false, + Schema: false }); return ( @@ -509,7 +341,7 @@ export function Asyncapi3SchemaFormatComparison({ className = '' }) {
setHoverState(prevState => ({ ...prevState, Payload: true }))} onMouseLeave={() => setHoverState({ Payload: false })}> payload
-
+
setHoverState(prevState => ({ ...prevState, Schema: true }))} onMouseLeave={() => setHoverState({ Schema: false })}> schema
@@ -544,7 +376,7 @@ export function Asyncapi3SchemaFormatComparison({ className = '' }) {
setHoverState(prevState => ({ ...prevState, SchemaFormat: true }))} onMouseLeave={() => setHoverState({ SchemaFormat: false })}> schemaFormat
-
+
setHoverState(prevState => ({ ...prevState, Schema: true }))} onMouseLeave={() => setHoverState({ Schema: false })}> schema
@@ -560,3 +392,110 @@ export function Asyncapi3SchemaFormatComparison({ className = '' }) {
) } + +/** + * Compares how the parameter object changed location from v2 to v3 + */ +export function Asyncapi3ParameterComparison({ className = '' }) { + const [hoverState, setHoverState] = useState({ + location: false, + description: false, + enum: false, + examples: false, + default: false + }); + + return ( +
+
+

AsyncAPI 2.x

+ +
+
+ components | channels + +
+
+ parameters + +
+
+ parameter +
+
setHoverState(prevState => ({ ...prevState, location: true }))} onMouseLeave={() => setHoverState({ location: false })}> + location +
+
setHoverState(prevState => ({ ...prevState, description: true }))} onMouseLeave={() => setHoverState({ description: false })}> + description +
+ +
+ schema +
+
type
+
setHoverState(prevState => ({ ...prevState, enum: true }))} onMouseLeave={() => setHoverState({ enum: false })}> + enum +
+
setHoverState(prevState => ({ ...prevState, examples: true }))} onMouseLeave={() => setHoverState({ examples: false })}> + examples +
+
setHoverState(prevState => ({ ...prevState, default: true }))} onMouseLeave={() => setHoverState({ default: false })}> + default +
+
setHoverState(prevState => ({ ...prevState, description: true }))} onMouseLeave={() => setHoverState({ description: false })}> + description +
+
pattern
+
multipleOf
+
And all other properties
+
+
+
+
+
+
+
+
+
+
+
+

AsyncAPI 3.0

+ +
+
+ components | channels + +
+
+ parameters + +
+
+ parameter +
+
setHoverState(prevState => ({ ...prevState, location: true }))} onMouseLeave={() => setHoverState({ location: false })}> + location +
+
setHoverState(prevState => ({ ...prevState, description: true }))} onMouseLeave={() => setHoverState({ description: false })}> + description +
+
setHoverState(prevState => ({ ...prevState, enum: true }))} onMouseLeave={() => setHoverState({ enum: false })}> + enum +
+
setHoverState(prevState => ({ ...prevState, examples: true }))} onMouseLeave={() => setHoverState({ examples: false })}> + examples +
+
setHoverState(prevState => ({ ...prevState, default: true }))} onMouseLeave={() => setHoverState({ default: false })}> + default +
+
+
+
+
+
+
+
+
+
+ ) +} diff --git a/pages/docs/migration/migrating-to-v3.md b/pages/docs/migration/migrating-to-v3.md index 9d20b8bbefcb..95b6709ca9aa 100644 --- a/pages/docs/migration/migrating-to-v3.md +++ b/pages/docs/migration/migrating-to-v3.md @@ -1,6 +1,9 @@ --- title: "Migrating to v3" --- + + + Migration to a new major version is always difficult, and AsyncAPI is no exception. To provide as smooth a transition as possible, this document shows the breaking changes between AsyncAPI v2 and v3 in an interactive manner. If you want to update your AsyncAPI document, use the [AsyncAPI converter](https://github.com/asyncapi/converter-js) directly in the CLI with the following command: @@ -11,9 +14,8 @@ asyncapi convert asyncapi.json --output=asyncapi_v3.json --target-version=3.0.0 For a detailed read-through about all the changes (non-breaking as well), read all the [v3 release notes](/blog/release-notes-3.0.0) first to acquire additional context about the changes introduced in v3. -import {Asyncapi3Comparison, Asyncapi3ChannelComparison, Asyncapi3IdAndAddressComparison, Asyncapi3MetaComparison, Asyncapi3OperationComparison,Asyncapi3SchemaFormatComparison, Asyncapi3ServerComparison} from '../../../components/Asyncapi3Comparison' - - +import {Asyncapi3ChannelComparison, Asyncapi3IdAndAddressComparison, Asyncapi3MetaComparison, Asyncapi3OperationComparison,Asyncapi3SchemaFormatComparison, Asyncapi3ServerComparison, +Asyncapi3ParameterComparison} from '../../../components/Asyncapi3Comparison' ## Moved metadata @@ -203,14 +205,17 @@ channels: user/signedup: message: oneOf: - - ... - - ... + - messageId: UserMessage + ... + - messageId: UserMessage2 + ... asyncapi: 2.6.0 ... channels: user/signedup: message: + messageId: UserMessage ... ``` @@ -236,6 +241,8 @@ channels: ... ``` +We have updated the structure of the Message Object by eliminating the `messageId` property. We now use the ID of the Message Object itself as the key in the key/value pairing, rendering a separate `messageId` property redundant. + ## Unifying explicit and implicit references In v2, implicit references were allowed in certain instances. For instance, the server security configuration was identified by name, linking to a [Security Schema Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#securitySchemeObject) within the components. Similarly, a channel could reference global servers by name. @@ -393,3 +400,44 @@ channels: {} asyncapi: 3.0.0 ... ``` + +## Restricted parameters object + +Parameters have often prioritized convenience over accurately reflecting real-world use cases. + + + +In v2, we significantly streamlined the Schema Object. While the previous version offered full capability with numerous, often underutilized options, it posed challenges in serializing objects or booleans in the channel path. + +The new v3 simplifies this by consistently using the string type and limiting available properties. Now, you can only access `enum`, `default`, `description`, `examples`, and `location`, ensuring a more focused and practical approach." + +```yml +asyncapi: 2.6.0 +... +channels: + user/{user_id}/signedup: + parameters: + location: "$message.payload" + description: Just a test description + schema: + type: string + enum: ["test"] + default: "test" + examples: ["test"] + ... +``` + +```yml +asyncapi: 3.0.0 +... +channels: + userSignedUp: + address: user/{user_id}/signedup + parameters: + user_id: + enum: ["test"] + default: "test" + description: Just a test description + examples: ["test"] + location: "$message.payload" +```