Skip to content

fix: retain examples from all messages of an AsyncAPI 3 operation - #2274

Merged
lbroudoux merged 1 commit into
microcks:masterfrom
dataGriff:fix/asyncapi3-multi-message-examples
Aug 18, 2026
Merged

lbroudoux merged 1 commit into
microcks:masterfrom
dataGriff:fix/asyncapi3-multi-message-examples

Conversation

@dataGriff

Copy link
Copy Markdown
Contributor

Description

Fixes #2273 — importing an AsyncAPI 3.x document where one operation references multiple messages retained only the last message's examples; all others were silently dropped, so async mocks published a single event type.

AsyncAPI3Importer.buildEventMessages reassigned its result list on each iteration of the message loop. This change initialises the list once and accumulates with addAll, matching the v2 importer's behaviour for message.oneOf.

Changes

  • AsyncAPI3Importer.buildEventMessages: accumulate examples across all operation messages (2 lines)
  • New test testMultiMessagesAsyncAPI3ImportYAML + resource spec with one send operation referencing two messages (2 + 1 examples): fails with expected: <3> but was: <1> before the fix, passes after; all existing AsyncAPI3ImporterTest tests still pass

🤖 Generated with Claude Code

buildEventMessages reassigned its result list on each message of the
operation, so only the last message's examples survived import. Accumulate
across messages instead, matching the AsyncAPI 2.x oneOf behaviour.

Fixes microcks#2273

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Richard Griffiths <[email protected]>
@github-actions

Copy link
Copy Markdown

👋 @dataGriff

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks all good. Thank you!

@lbroudoux
lbroudoux merged commit 4d3991f into microcks:master Aug 18, 2026
19 of 22 checks passed
@github-actions

Copy link
Copy Markdown

🎉 @dataGriff

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AsyncAPI 3.x import: only the last message's examples are retained for multi-message operations

2 participants