Skip to content

Instantly share code, notes, and snippets.

@aayushmau5
Created June 17, 2023 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aayushmau5/4eaa537a2045800912c277833cc778d6 to your computer and use it in GitHub Desktop.
Save aayushmau5/4eaa537a2045800912c277833cc778d6 to your computer and use it in GitHub Desktop.
AsyncAPI diff quick prototype example
const {diff} = require('@asyncapi/diff');
const {Parser, fromFile} = require("@asyncapi/parser");
const parser = new Parser();
async function main() {
const firstDocumentFile = fromFile(parser, './test/fixtures/asyncapi_v1.yml');
const SecondDocumentFile = fromFile(parser, './test/fixtures/asyncapi_v2.yml');
const firstDocument = await firstDocumentFile.parse();
const secondDocument = await SecondDocumentFile.parse();
const diffOutput = diff(firstDocument.document.json(), secondDocument.document.json(), {
outputType: 'md'
});
const allChanegs = diffOutput.getOutput();
console.log(allChanegs);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment