Skip to content

docs: update AsyncAPI example to v3 syntax in Python tutorial#1822

Closed
payal723 wants to merge 1 commit intoasyncapi:masterfrom
payal723:docs/update-python-tutorial-asyncapi-v3
Closed

docs: update AsyncAPI example to v3 syntax in Python tutorial#1822
payal723 wants to merge 1 commit intoasyncapi:masterfrom
payal723:docs/update-python-tutorial-asyncapi-v3

Conversation

@payal723
Copy link

@payal723 payal723 commented Jan 9, 2026

I've updated the AsyncAPI example used in the Python MQTT tutorial to use version 3 syntax. Earlier it was using v2.6.0, so I migrated the structure to match v3 updated channels, operations, and message definitions accordingly.
I kept the changes minimal and only focused on the YAML file for now. No template or parser logic was touched.
Also validated the file locally using asyncapi validate and it checks out.
This is just the first small step toward fully updating the tutorial to v3. Let me know if anything needs tweaking!

Summary by CodeRabbit

  • Documentation
    • Updated sample AsyncAPI template from version 2.6.0 to 3.0.0
    • Restructured channel and message definitions to align with AsyncAPI 3.x specifications
    • Updated server addressing configuration syntax for improved compatibility
    • Enhanced component schema definitions with new structural references

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

⚠️ No Changeset found

Latest commit: 3d291a8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

Updates the AsyncAPI sample document in generator-template.md from version 2.6.0 to 3.0.0, restructuring channel definitions, server configuration (url to host), and introducing new components for schemas and operations to align with AsyncAPI 3.x semantics.

Changes

Cohort / File(s) Summary
AsyncAPI Template Documentation
apps/generator/docs/generator-template.md
Updated sample AsyncAPI document: version bumped to 3.0.0; server url property changed to host; channel renamed to temperatureChangedChannel with explicit address; replaced inline payload with schema reference; added components.schemas.temperatureId and components.operations.temperatureChange; restructured messages block and operation mappings

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: updating an AsyncAPI example from v2 to v3 syntax in documentation, using imperative mood and conventional commit format.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c49e8aa and 3d291a8.

📒 Files selected for processing (1)
  • apps/generator/docs/generator-template.md
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe
3. Messages are defined under a 'messages' container in channels
4. Servers can use a 'host' property
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with action property (send/receive) and references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe operations
3. Messages are defined under a 'messages' container in channels
4. The specification decouples operations, channels and messages to improve reusability
5. Servers can use a 'host' property
Learnt from: CR
Repo: asyncapi/generator PR: 0
File: .github/pr-review-checklist.md:0-0
Timestamp: 2026-01-05T09:57:34.800Z
Learning: Update relevant Generator documentation to accurately reflect PR changes introduced
Learnt from: derberg
Repo: asyncapi/generator PR: 1536
File: packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml:48-53
Timestamp: 2025-05-06T12:39:42.189Z
Learning: In AsyncAPI 3.0.0, security schemes can be defined inline directly at various levels including the server level, and don't need to be centrally defined in components.securitySchemes first. This is a change from previous versions of the AsyncAPI specification.
Learnt from: derberg
Repo: asyncapi/generator PR: 1536
File: packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml:48-53
Timestamp: 2025-05-06T12:39:42.189Z
Learning: In AsyncAPI 3.0, security schemes can be defined inline directly at the server level (and other levels) and don't need to be centrally defined in components.securitySchemes first. This is a change from previous versions of the AsyncAPI specification. The PR's approach with inline security definition is valid:
```yaml
security:
- type: http
  scheme: bearer
  bearerFormat: OAuth2
  description: |
    First you need to obtain a token...
```
📚 Learning: 2025-05-12T14:23:48.919Z
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe
3. Messages are defined under a 'messages' container in channels
4. Servers can use a 'host' property

Applied to files:

  • apps/generator/docs/generator-template.md
📚 Learning: 2025-05-12T14:23:48.919Z
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with action property (send/receive) and references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe operations
3. Messages are defined under a 'messages' container in channels
4. The specification decouples operations, channels and messages to improve reusability
5. Servers can use a 'host' property

Applied to files:

  • apps/generator/docs/generator-template.md
📚 Learning: 2026-01-05T09:57:34.800Z
Learnt from: CR
Repo: asyncapi/generator PR: 0
File: .github/pr-review-checklist.md:0-0
Timestamp: 2026-01-05T09:57:34.800Z
Learning: Update relevant Generator documentation to accurately reflect PR changes introduced

Applied to files:

  • apps/generator/docs/generator-template.md
🔇 Additional comments (1)
apps/generator/docs/generator-template.md (1)

45-85: AsyncAPI v3.0.0 example structure is correct.

The example follows the AsyncAPI 3.0.0 specification correctly:

  • Server uses host property for the broker address
  • Channel defines address for the topic path
  • Messages are properly organized in a messages container within the channel
  • Operations are top-level with action: receive, channel reference, and message references that correctly point to the channel's messages

Example validates against the v3.0.0 specification.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@asyncapi-bot
Copy link
Contributor

What reviewer looks at during PR review

The following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.

  1. PR Title: Use a concise title that follows our Conventional Commits guidelines and clearly summarizes the change using imperative mood (it means spoken or written as if giving a command or instruction, like "add new helper for listing operations")

    Note - In Generator, prepend feat: or fix: in PR title only when PATCH/MINOR release must be triggered.

  2. PR Description: Clearly explain the issue being solved, summarize the changes made, and mention the related issue.

    Note - In Generator, we use Maintainers Work board to track progress. Ensure the PR Description includes Resolves #<issue-number> or Fixes #<issue-number> this will automatically close the linked issue when the PR is merged and helps automate the maintainers workflow.

  3. Documentation: Update the relevant Generator documentation to accurately reflect the changes introduced in the PR, ensuring users and contributors have up-to-date guidance.

  4. Comments and JSDoc: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions, so others can easily understand and use the code.

  5. DRY Code: Ensure the code follows the Don't Repeat Yourself principle. Look out for duplicate logic that can be reused.

  6. Test Coverage: Ensure the new code is well-tested with meaningful test cases that pass consistently and cover all relevant edge cases.

  7. Commit History: Contributors should avoid force-pushing as much as possible. It makes it harder to track incremental changes and review the latest updates.

  8. Template Design Principles Alignment: While reviewing template-related changes in the packages/ directory, ensure they align with the Assumptions and Principles. If any principle feels outdated or no longer applicable, start a discussion these principles are meant to evolve with the project.

  9. Reduce Scope When Needed: If an issue or PR feels too large or complex, consider splitting it and creating follow-up issues. Smaller, focused PRs are easier to review and merge.

  10. Bot Comments: As reviewers, check that contributors have appropriately addressed comments or suggestions made by automated bots. If there are bot comments the reviewer disagrees with, react to them or mark them as resolved, so the review history remains clear and accurate.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 9, 2026

@asyncapi-bot
Copy link
Contributor

🚀 Docs preview deployed
Below link points directly to the generator docs preview. May the force be with you!
https://6960ee8c272a93a60dc875c0--asyncapi-website.netlify.app/docs/tools/generator

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/generator/docs/generator-template.md (3)

602-628: Update AsyncAPI example in section 5d to v3 syntax.

Section "5d. Update AsyncAPI document" (lines 602-628) still uses AsyncAPI v2 syntax with publish operations nested directly under channels:

channels:
  temperature/dropped:
    publish:
      operationId: temperatureDrop

This contradicts the v3 example shown earlier (lines 60-75), which uses separate channels with address and top-level operations sections. To avoid confusing users, this section should be updated to v3 syntax to match the earlier migration.

🔄 Proposed v3 update for section 5d

Update the example to use v3 structure:

channels:
  temperatureDroppedChannel:
    address: temperature/dropped
    description: Notifies the user when the temperature drops past a certain point.
    messages:
      temperatureDropMessage:
        description: Message that is being sent when the temperature drops past a certain point.
        payload:
          $ref: '#/components/schemas/temperatureId'

  temperatureRisenChannel:
    address: temperature/risen
    description: Notifies the user when the temperature rises past a certain point.
    messages:
      temperatureRisenMessage:
        description: Message that is being sent when the temperature rises past a certain point.
        payload:
          $ref: '#/components/schemas/temperatureId'

operations:
  temperatureDrop:
    action: receive
    channel:
      $ref: '#/channels/temperatureDroppedChannel'
    messages:
      - $ref: '#/channels/temperatureDroppedChannel/messages/temperatureDropMessage'

  temperatureRise:
    action: receive
    channel:
      $ref: '#/channels/temperatureRisenChannel'
    messages:
      - $ref: '#/channels/temperatureRisenChannel/messages/temperatureRisenMessage'

Based on learnings, this inconsistency should be addressed before merging, as leaving the v2 syntax later in the tutorial defeats the purpose of the migration and will create confusion for users following the tutorial.


526-540: Fix the channel-to-operations access pattern for AsyncAPI v3 compatibility.

The getTopics function calls ch.operations().filterByReceive() which is incompatible with AsyncAPI v3. In v3, operations are top-level decoupled entities that reference channels via $ref, not vice versa. The channel object does not expose an .operations() method.

Correct the pattern to iterate operations at the document level and filter for those referencing the target channel:

const operationsForChannel = asyncapi.operations().all().filter(op => op.channel().id() === ch.id());
const receiveOp = operationsForChannel.find(op => op.action() === 'receive');
const operationId = receiveOp?.id();

399-399: Update server URL accessor for AsyncAPI v3 compatibility.

The .url() method does not exist in AsyncAPI v3 servers. The v3 Server Object was split into separate host, pathname, and protocol properties. Update lines 399, 413, and 444 to use asyncapi.servers().get(params.server).host() and .pathname() instead of .url(), or construct the full URL from these components as needed.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c49e8aa and 3d291a8.

📒 Files selected for processing (1)
  • apps/generator/docs/generator-template.md
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe
3. Messages are defined under a 'messages' container in channels
4. Servers can use a 'host' property
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with action property (send/receive) and references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe operations
3. Messages are defined under a 'messages' container in channels
4. The specification decouples operations, channels and messages to improve reusability
5. Servers can use a 'host' property
Learnt from: CR
Repo: asyncapi/generator PR: 0
File: .github/pr-review-checklist.md:0-0
Timestamp: 2026-01-05T09:57:34.800Z
Learning: Update relevant Generator documentation to accurately reflect PR changes introduced
Learnt from: derberg
Repo: asyncapi/generator PR: 1536
File: packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml:48-53
Timestamp: 2025-05-06T12:39:42.189Z
Learning: In AsyncAPI 3.0.0, security schemes can be defined inline directly at various levels including the server level, and don't need to be centrally defined in components.securitySchemes first. This is a change from previous versions of the AsyncAPI specification.
Learnt from: derberg
Repo: asyncapi/generator PR: 1536
File: packages/templates/clients/websocket/test/__fixtures__/asyncapi-slack-client.yml:48-53
Timestamp: 2025-05-06T12:39:42.189Z
Learning: In AsyncAPI 3.0, security schemes can be defined inline directly at the server level (and other levels) and don't need to be centrally defined in components.securitySchemes first. This is a change from previous versions of the AsyncAPI specification. The PR's approach with inline security definition is valid:
```yaml
security:
- type: http
  scheme: bearer
  bearerFormat: OAuth2
  description: |
    First you need to obtain a token...
```
📚 Learning: 2025-05-12T14:23:48.919Z
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe
3. Messages are defined under a 'messages' container in channels
4. Servers can use a 'host' property

Applied to files:

  • apps/generator/docs/generator-template.md
📚 Learning: 2025-05-12T14:23:48.919Z
Learnt from: derberg
Repo: asyncapi/generator PR: 1551
File: apps/generator/docs/generator-template.md:45-73
Timestamp: 2025-05-12T14:23:48.919Z
Learning: AsyncAPI 3.0.0 specification introduces significant structural changes from 2.x:
1. Operations become top-level elements with action property (send/receive) and references to channels
2. Channels use 'address' for the topic path instead of having nested publish/subscribe operations
3. Messages are defined under a 'messages' container in channels
4. The specification decouples operations, channels and messages to improve reusability
5. Servers can use a 'host' property

Applied to files:

  • apps/generator/docs/generator-template.md
📚 Learning: 2026-01-05T09:57:34.800Z
Learnt from: CR
Repo: asyncapi/generator PR: 0
File: .github/pr-review-checklist.md:0-0
Timestamp: 2026-01-05T09:57:34.800Z
Learning: Update relevant Generator documentation to accurately reflect PR changes introduced

Applied to files:

  • apps/generator/docs/generator-template.md
🔇 Additional comments (1)
apps/generator/docs/generator-template.md (1)

45-85: AsyncAPI v3.0.0 example structure is correct.

The example follows the AsyncAPI 3.0.0 specification correctly:

  • Server uses host property for the broker address
  • Channel defines address for the topic path
  • Messages are properly organized in a messages container within the channel
  • Operations are top-level with action: receive, channel reference, and message references that correctly point to the channel's messages

Example validates against the v3.0.0 specification.

@derberg
Copy link
Member

derberg commented Jan 13, 2026

sorry but all necessary feedback was provided in #1749

if you do not have time to carefully read through it and address it, or ask specific questions to exact feedback points, I also cannot spend time on your PR.

closing.

I focus on #1826 only

@derberg derberg closed this Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants