diff --git a/src/commands/bundle.ts b/src/commands/bundle.ts index d014fbbe2ff..dfd73401cf4 100644 --- a/src/commands/bundle.ts +++ b/src/commands/bundle.ts @@ -33,13 +33,6 @@ export default class Bundle extends Command { const outputFormat = path.extname(argv[0]); const AsyncAPIFiles = await this.loadFiles(argv); - const containsAsyncAPI3 = AsyncAPIFiles.filter((file) => { - return file.isAsyncAPI3(); - }); - if (containsAsyncAPI3.length > 0) { - this.error('One of the files you tried to bundle is AsyncAPI v3 format, the bundle command does not support it yet, please checkout https://github.com/asyncapi/bundler/issues/133'); - } - if (flags.base) {baseFile = (await load(flags.base)).text();} const fileContents = AsyncAPIFiles.map((file) => file.text()); diff --git a/test/integration/bundle/bundle.test.ts b/test/integration/bundle/bundle.test.ts index dcfe4de72d1..0cc20e7cb31 100644 --- a/test/integration/bundle/bundle.test.ts +++ b/test/integration/bundle/bundle.test.ts @@ -4,7 +4,6 @@ import path from 'path'; import { fileCleanup } from '../../helpers'; const spec = fs.readFileSync('./test/integration/bundle/final-asyncapi.yaml', {encoding: 'utf-8'}); -const asyncapiv3 = './test/fixtures/specification-v3.yml'; function validateGeneratedSpec(filePath: string, spec: string) { const generatedSPec = fs.readFileSync(path.resolve(filePath), { encoding: 'utf-8' }); @@ -12,21 +11,6 @@ function validateGeneratedSpec(filePath: string, spec: string) { } describe('bundle', () => { - describe('should handle AsyncAPI v3 document correctly', () => { - test - .stderr() - .stdout() - .command([ - 'bundle', - asyncapiv3, - '--output=./test/integration/bundle/final.yaml']) - .it('give error', (ctx, done) => { - expect(ctx.stderr).to.equal('Error: One of the files you tried to bundle is AsyncAPI v3 format, the bundle command does not support it yet, please checkout https://github.com/asyncapi/bundler/issues/133\n'); - expect(ctx.stdout).to.equal(''); - done(); - }); - }); - test .stdout() .command([ @@ -100,3 +84,16 @@ describe('bundle', () => { done(); }); }); + +describe('bundle spec v3', () => { + test + .stdout() + .command([ + 'bundle', './test/integration/bundle/first-asyncapiv3.yaml', + '--output=test/integration/bundle/final.yaml', + ]).it('should be able to bundle v3 spec correctly', (ctx, done) => { + expect(ctx.stdout).to.contain('Check out your shiny new bundled files at test/integration/bundle/final.yaml\n'); + fileCleanup('./test/integration/bundle/final.yaml'); + done(); + }); +}); diff --git a/test/integration/bundle/first-asyncapiv3.yaml b/test/integration/bundle/first-asyncapiv3.yaml new file mode 100644 index 00000000000..117d7bad68c --- /dev/null +++ b/test/integration/bundle/first-asyncapiv3.yaml @@ -0,0 +1,34 @@ +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: This service is in charge of processing user signupsA +channels: + userSignedup: + address: 'user/signedup' + messages: + userSignedUpMessage: + $ref: './test/integration/bundle/messages.yaml#/messages/UserSignedUp' + test: + address: '/test' + messages: + testMessage: + $ref: '#/components/messages/TestMessage' +operations: + UserSignedUp: + action: send + channel: + $ref: '#/channels/userSignedup' + messages: + - $ref: './test/integration/bundle/messages.yaml#/messages/UserSignedUp' + TestOpp: + action: send + channel: + $ref: '#/channels/test' + messages: + - $ref: '#/components/messages/TestMessage' +components: + messages: + TestMessage: + payload: + type: string \ No newline at end of file