Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: removing v3 check for bundle command #1138

Merged
merged 9 commits into from
Mar 19, 2024
7 changes: 0 additions & 7 deletions src/commands/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
17 changes: 1 addition & 16 deletions test/integration/bundle/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,14 @@ 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';
//const asyncapiv3 = './test/fixtures/specification-v3.yml';
Souvikns marked this conversation as resolved.
Show resolved Hide resolved

function validateGeneratedSpec(filePath: string, spec: string) {
const generatedSPec = fs.readFileSync(path.resolve(filePath), { encoding: 'utf-8' });
return generatedSPec === spec;
}

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([
Expand Down
Loading