Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

fix: work correctly on pre-parsed AsyncAPI docs when given as Input #103

Merged
3 changes: 2 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ const parser = require('@asyncapi/parser');
* @param {Array} asyncApiDocs unparsed AsyncAPI documents
* @returns {Promise<Array>} parsed AsyncAPI documents
*/

function validate(asyncApiDocs) {
return Promise.all(asyncApiDocs.map(async doc => {
if (doc && doc['x-parser-spec-parsed'] === true) {
if (typeof doc === 'object' && doc.ext && doc.ext('x-parser-spec-parsed')) {
arjungarg07 marked this conversation as resolved.
Show resolved Hide resolved
return doc;
}
return parser.parse(doc);
Expand Down