generator icon indicating copy to clipboard operation
generator copied to clipboard

docs: rewrite Java template tutorial to AsyncAPI v3

Open Amythystx opened this issue 8 months ago • 12 comments

Description

Rewrites the "Creating a template – Java" tutorial to use AsyncAPI v3.

Changes made:

  • Updates AsyncAPI document from v2.6.0 to v3.0.0
  • Replaces url: with host: in servers section
  • Migrates TopicFunction to use operations API instead of channels API
  • Renames getTopics to getTopicsFromOperations
  • Updates index.js to use asyncapi.operations().filterByReceive()
  • Updates server URL to use server.host()
  • Fixes duplicated "generated generated" text in output logs

Related issue

Resolves #1828

Summary by CodeRabbit

  • Documentation
    • Updated Java tutorial and examples to AsyncAPI v3 format and refreshed embedded examples.
  • New Features
    • Template now generates topic methods from v3 operations and uses server information for broker URL generation in the generated client.
  • Bug Fixes
    • Fixed duplicated console/log output in the example client and corrected end-of-file newline in the tutorial.

Amythystx avatar Mar 25 '26 11:03 Amythystx

⚠️ No Changeset found

Latest commit: 6222fcc887cac74a54d70e0cd74de3e566ee664c

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

changeset-bot[bot] avatar Mar 25 '26 11:03 changeset-bot[bot]

📝 Walkthrough

Walkthrough

Updated the Java template tutorial to AsyncAPI v3 and generator v2: examples, template wiring, and TopicFunction now use AsyncAPI v3 operations and server APIs; example YAML and package.json updated; duplicated log text and EOF newline fixes applied. (≤50 words)

Changes

Cohort / File(s) Summary
Generator Java tutorial
apps/generator/docs/generator-template-java.md
Rewrote examples to AsyncAPI v3 and generator v2: switched from channel-based to operations-based API (TopicFunction({ operations }), getTopicsFromOperations(operations)), updated topic extraction to use op.channel().address() and op.id(), updated template wiring to use asyncapi.operations() and const server = asyncapi.server(params.server), changed generated Client.java broker URL construction to use server.host(), bumped generator.apiVersion / version range in package.json examples, migrated embedded AsyncAPI YAML to asyncapi: 3.0.0, fixed duplicated log text in TestClient.java snippet, removed an unused import, and corrected EOF newline.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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—rewriting the Java template tutorial to use AsyncAPI v3. It follows Conventional Commits format with the 'docs:' prefix and uses imperative mood.
Linked Issues check ✅ Passed The PR successfully addresses all objectives from issue #1828: updates AsyncAPI document from v2.6.0 to v3.0.0, migrates template code to use v3 operations API, and aligns with other language tutorials.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objectives: AsyncAPI v3 migration, operations API usage, server URL access updates, and duplicate text fix are all in scope.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

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.

coderabbitai[bot] avatar Mar 25 '26 11:03 coderabbitai[bot]

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

asyncapi-bot avatar Mar 25 '26 11:03 asyncapi-bot

/u

Adi-204 avatar Apr 09 '26 04:04 Adi-204

and please make sure that your changes to AsyncAPI YAML are exactly the same as in the similar tutorial but python one

derberg avatar Apr 21 '26 12:04 derberg

Thanks for the review @derberg! Will fix all the issues shortly

Amythystx avatar Apr 21 '26 13:04 Amythystx

hello @derberg fixed all three issues: updated apiVersion to v2 and generator range to >=2.0.0 <3.0.0 removed double filterByReceive() in index.js, filtering now happens only inside TopicFunction.js changed action: send to action: receive in AsyncAPI YAML

Amythystx avatar Apr 23 '26 02:04 Amythystx

@wei123-web do you have repo where we can see the test project? where you prove you went through the final tutorial, created project basing on instructions and made sure it is working?

derberg avatar May 20 '26 05:05 derberg

if you look in some of the comments, they indicate that template created with this tutorial would not work. It is important that after your changes you go through tutorial, create template by copy/paste and config generated code works

derberg avatar May 20 '26 14:05 derberg

if you look in some of the comments, they indicate that template created with this tutorial would not work. It is important that after your changes you go through tutorial, create template by copy/paste and config generated code works

Hi @derberg! I will fix all the issues you mentioned, test the full tutorial end to end, and update the YAML to match the Python tutorial shortly!

Amythystx avatar May 22 '26 05:05 Amythystx

any news @wei123-web

derberg avatar Jun 14 '26 14:06 derberg