Skip to content

Commit 18f3adf

Browse files
authored
fix: update template to work with @asyncapi/parser 2.x (#272)
1 parent be8bdee commit 18f3adf

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

template/src/lib/asyncapi.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const fs = require('fs');
22
const path = require('path');
3-
const { parse } = require('@asyncapi/parser');
3+
const { Parser } = require('@asyncapi/parser');
4+
5+
const parser = new Parser();
46

57
let cached;
68

@@ -20,7 +22,7 @@ module.exports.init = async () => {
2022
}
2123

2224
try {
23-
cached = await parse(content);
25+
cached = await parser.parse(content);
2426
} catch (e) {
2527
throw e;
2628
}

test/__snapshots__/integration.test.js.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ router.ws('/echo', async (ws, req) => {
5555
exports[`template integration test using generator should generate application files 3`] = `
5656
"const fs = require('fs');
5757
const path = require('path');
58-
const { parse } = require('@asyncapi/parser');
58+
const { Parser } = require('@asyncapi/parser');
59+
60+
const parser = new Parser();
5961
6062
let cached;
6163
@@ -75,7 +77,7 @@ module.exports.init = async () => {
7577
}
7678
7779
try {
78-
cached = await parse(content);
80+
cached = await parser.parse(content);
7981
} catch (e) {
8082
throw e;
8183
}

0 commit comments

Comments
 (0)