Repository navigation
fix: retain examples from all messages of an AsyncAPI 3 operation - #2274
Conversation
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]>
|
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
left a comment
There was a problem hiding this comment.
It looks all good. Thank you!
|
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 🙌 |
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.buildEventMessagesreassigned its result list on each iteration of the message loop. This change initialises the list once and accumulates withaddAll, matching the v2 importer's behaviour formessage.oneOf.Changes
AsyncAPI3Importer.buildEventMessages: accumulate examples across all operation messages (2 lines)testMultiMessagesAsyncAPI3ImportYAML+ resource spec with onesendoperation referencing two messages (2 + 1 examples): fails withexpected: <3> but was: <1>before the fix, passes after; all existingAsyncAPI3ImporterTesttests still pass🤖 Generated with Claude Code