Skip to content

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

Open
leefreemanxyz wants to merge 2 commits intoRedocly:mainfrom
leefreemanxyz:fix/correct-sort-order-for-async-api-keys
Open

fix: correct sort order for async API keys and update related tests#2741
leefreemanxyz wants to merge 2 commits intoRedocly:mainfrom
leefreemanxyz:fix/correct-sort-order-for-async-api-keys

Conversation

@leefreemanxyz
Copy link
Copy Markdown

@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 when bundling/joining specs, with coverage via updated unit/e2e snapshots.

Overview
AsyncAPI bundling output is now normalized to a stable top-level key order (ensuring asyncapi appears first), bringing it in line with existing OpenAPI key ordering.

This replaces sortTopLevelKeysForOas with a generalized sortTopLevelKeys that supports OAS2/OAS3 plus AsyncAPI 2/3, updates bundle/join to use it, and adjusts unit tests and AsyncAPI e2e snapshots accordingly. A patch changeset is included for @redocly/cli.

Reviewed by Cursor Bugbot for commit f12216b. 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: f12216b

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 from 61fedb3 to ad87eec Compare April 14, 2026 13:02
@leefreemanxyz leefreemanxyz force-pushed the fix/correct-sort-order-for-async-api-keys branch from ad87eec to f12216b Compare April 14, 2026 13:54
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

1 participant