Skip to content

fix: correct sort order for async API keys and update related tests#2741

Merged
DmitryAnansky merged 3 commits intoRedocly:mainfrom
leefreemanxyz:fix/correct-sort-order-for-async-api-keys
Apr 16, 2026
Merged

fix: correct sort order for async API keys and update related tests#2741
DmitryAnansky merged 3 commits intoRedocly:mainfrom
leefreemanxyz:fix/correct-sort-order-for-async-api-keys

Conversation

@leefreemanxyz
Copy link
Copy Markdown
Contributor

@leefreemanxyz leefreemanxyz commented Apr 14, 2026

What/Why/How?

This resolves #2740. AsyncApi definitions will now bundle with a regular order, including the asyncapi: <version> appearing as the first line. This brings the behaviour for bundling for AsyncAPI in line with that of the OpenAPI bundling.

Reference

???

Testing

I've added unit tests and fixed any broken ones.

Screenshots (optional)

Check yourself

  • This PR follows the contributing guide
  • All new/updated code is covered by tests
  • [?] Core code changed? - Tested with other Redocly products (internal contributions only)
  • [Nope] New package installed? - Tested in different environments (browser/node)
  • [N/A] Documentation update has been considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

Note

Low Risk
Low risk: changes only affect deterministic output ordering during bundle/join, with coverage via updated unit and e2e snapshot tests.

Overview
Ensures bundled AsyncAPI documents have a consistent top-level key order (including asyncapi as the first key), bringing AsyncAPI output in line with existing OpenAPI key ordering.

Replaces sortTopLevelKeysForOas with a generalized sortTopLevelKeys that supports OAS2/OAS3 plus AsyncAPI 2/3, updates bundle/join to use it, and adjusts/extends unit tests and AsyncAPI e2e snapshots accordingly.

Reviewed by Cursor Bugbot for commit 5f7feb2. Bugbot is set up for automated code reviews on this repo. Configure here.

@leefreemanxyz leefreemanxyz requested review from a team as code owners April 14, 2026 13:01
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: 5f7feb2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/cli Patch
@redocly/openapi-core Patch
@redocly/respect-core Patch

Not sure what this means? Click here to learn what changesets are.

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

@leefreemanxyz leefreemanxyz force-pushed the fix/correct-sort-order-for-async-api-keys branch 2 times, most recently from ad87eec to f12216b Compare April 14, 2026 13:54
@leefreemanxyz leefreemanxyz force-pushed the fix/correct-sort-order-for-async-api-keys branch from f12216b to 4a5c91b Compare April 15, 2026 08:06
Comment thread .changeset/smooth-dancers-shave.md Outdated
Co-authored-by: Dmytro Anansky <dmytro@redocly.com>
Copy link
Copy Markdown
Contributor

@DmitryAnansky DmitryAnansky left a comment

Choose a reason for hiding this comment

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

@leefreemanxyz
Thank you for your contribution!

@DmitryAnansky DmitryAnansky merged commit 0d3b0f4 into Redocly:main Apr 16, 2026
59 of 61 checks passed
@DmitryAnansky
Copy link
Copy Markdown
Contributor

Hi @leefreemanxyz
The fix should be available in v2.28.1.
Thank you.

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.

AsyncApi keys are not ordered when bundled

3 participants