Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
79662dc
Add support for AsyncAPI 2 and 3 in the split command
tibisabau Feb 10, 2026
5df9f4a
Refactor split command
tibisabau Mar 13, 2026
76fe3a4
revert package lock
tibisabau Mar 13, 2026
77c89b4
add main package-lock
tibisabau Mar 13, 2026
f829e9f
fix: fix changeset and add unit tests
tibisabau Mar 23, 2026
6de23c8
Update tests/e2e/split/asyncapi3-basic/asyncapi.yaml
tibisabau Mar 24, 2026
c682457
fix: update snapshots
tibisabau Mar 24, 2026
15d13fd
fix: refactor split and add e2e test
tibisabau Mar 25, 2026
4d328bd
fix: fix channel refs in operations after split and correct casing
tibisabau Mar 26, 2026
0e77e75
fix: restore package lock
tibisabau Mar 26, 2026
cb77447
fix: restore package lock from origin
tibisabau Mar 26, 2026
27f1754
fix: split securitySchemes and other component types, fix refs in cha…
tibisabau Mar 27, 2026
8c0ae84
fix: move security from channels to operations in complex fixture
tibisabau Mar 30, 2026
a8cc911
Merge branch 'main' into feat/add-support-asyncapi23-split
DmitryAnansky Mar 31, 2026
ac4ad1b
fix: fix channel refs in replies components and add replies to comple…
tibisabau Mar 31, 2026
c5667b4
fix: replace as any casts, add ChannelsFiles type, fix ref resolution…
tibisabau Apr 1, 2026
0e3f287
fix: expand Async2Definition with proper top-level fields, remove Asy…
tibisabau Apr 2, 2026
4bb74b0
Merge branch 'main' into feat/add-support-asyncapi23-split
DmitryAnansky Apr 3, 2026
5332b31
Merge branch 'main' into feat/add-support-asyncapi23-split
DmitryAnansky Apr 3, 2026
6b8c7f8
fix: remove unneeded casts
tibisabau Apr 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-cougars-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": minor
---

Added support for AsyncAPI v2 and v3 in the split command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"asyncapi": "2.6.0",
"info": {
"title": "Test AsyncAPI 2",
"version": "1.0.0"
},
"channels": {
"user/signedup": {
"subscribe": {
"message": {
"payload": {
"type": "object",
"properties": {
"userId": { "type": "string" }
}
}
}
}
}
},
"components": {
"schemas": {
"UserSignedUp": {
"type": "object",
"properties": {
"userId": { "type": "string" }
}
}
},
"messages": {
"UserSignedUpMessage": {
"payload": {
"$ref": "#/components/schemas/UserSignedUp"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"asyncapi": "3.0.0",
"info": {
"title": "Test AsyncAPI 3",
"version": "1.0.0"
},
"channels": {
"userSignedUp": {
"address": "user/signedup",
"messages": {
"UserSignedUpMessage": {
"$ref": "#/components/messages/UserSignedUpMessage"
}
}
}
},
"operations": {
"UserSignedUp": {
"action": "send",
"channel": {
"$ref": "#/channels/userSignedUp"
}
}
},
"components": {
"schemas": {
"UserSignedUp": {
"type": "object",
"properties": {
"userId": { "type": "string" }
}
}
},
"messages": {
"UserSignedUpMessage": {
"payload": {
"$ref": "#/components/schemas/UserSignedUp"
}
}
}
}
}
50 changes: 50 additions & 0 deletions packages/cli/src/commands/split/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,54 @@ describe('split', () => {

expect(utils.escapeLanguageName).toBeCalledTimes(3);
});

it('should split an AsyncAPI 2 file and show the success message', async () => {
const filePath = 'packages/cli/src/commands/split/__tests__/fixtures/asyncapi2.json';

vi.spyOn(process.stderr, 'write').mockImplementation(() => true);

await handleSplit({
argv: {
api: filePath,
outDir: openapiDir,
separator: '_',
},
config: configFixture,
version: 'cli-version',
});

expect(vi.mocked(process.stderr.write)).toBeCalledTimes(2);
expect(vi.mocked(process.stderr.write).mock.calls[0][0]).toBe(
`🪓 Document: ${blue(filePath!)} ${green('is successfully split')}
and all related files are saved to the directory: ${blue(openapiDir)} \n`
);
expect(vi.mocked(process.stderr.write).mock.calls[1][0]).toContain(
`${filePath}: split processed in <test>ms`
);
});

it('should split an AsyncAPI 3 file and show the success message', async () => {
const filePath = 'packages/cli/src/commands/split/__tests__/fixtures/asyncapi3.json';

vi.spyOn(process.stderr, 'write').mockImplementation(() => true);

await handleSplit({
argv: {
api: filePath,
outDir: openapiDir,
separator: '_',
},
config: configFixture,
version: 'cli-version',
});

expect(vi.mocked(process.stderr.write)).toBeCalledTimes(2);
expect(vi.mocked(process.stderr.write).mock.calls[0][0]).toBe(
`🪓 Document: ${blue(filePath!)} ${green('is successfully split')}
and all related files are saved to the directory: ${blue(openapiDir)} \n`
);
expect(vi.mocked(process.stderr.write).mock.calls[1][0]).toContain(
`${filePath}: split processed in <test>ms`
);
});
});
Loading
Loading