Created
June 17, 2023 17:52
-
-
Save aayushmau5/4eaa537a2045800912c277833cc778d6 to your computer and use it in GitHub Desktop.
AsyncAPI diff quick prototype example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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