@asyncapi/parser
Advanced tools
Comparing version 0.28.1 to 0.28.2
@@ -15,2 +15,5 @@ const Ajv = require('ajv'); | ||
async function parse({ message, originalAsyncAPIDocument, fileFormat, parsedAsyncAPIDocument, pathToPayload }) { | ||
const payload = message.payload; | ||
if (!payload) return; | ||
const ajv = new Ajv({ | ||
@@ -24,3 +27,3 @@ jsonPointers: true, | ||
const validate = ajv.compile(payloadSchema); | ||
const valid = validate(message.payload); | ||
const valid = validate(payload); | ||
@@ -27,0 +30,0 @@ if (!valid) throw new ParserError({ |
{ | ||
"name": "@asyncapi/parser", | ||
"version": "0.28.1", | ||
"version": "0.28.2", | ||
"description": "JavaScript AsyncAPI parser.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -80,2 +80,23 @@ const parser = require('../lib'); | ||
}); | ||
it('should not throw error if payload not provided', async function() { | ||
const inputString = `{ | ||
"asyncapi": "2.0.0", | ||
"info": { | ||
"title": "My API", | ||
"version": "1.0.0" | ||
}, | ||
"channels": { | ||
"mychannel": { | ||
"publish": { | ||
"message": { | ||
} | ||
} | ||
} | ||
} | ||
}`; | ||
const parsedInput = JSON.parse(inputString); | ||
expect(async () => await parser.parse(parsedInput)).to.not.throw(); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1093146
9399