Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asyncapi/parser

Package Overview
Dependencies
Maintainers
3
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asyncapi/parser - npm Package Compare versions

Comparing version 1.6.0-2021-06-release.1 to 1.6.0-2021-06-release.2

3

lib/asyncapiSchemaFormatParser.js

@@ -46,4 +46,7 @@ const Ajv = require('ajv');

'application/vnd.aai.asyncapi;version=2.0.0',
'application/vnd.aai.asyncapi;version=2.1.0',
'application/vnd.aai.asyncapi+json;version=2.0.0',
'application/vnd.aai.asyncapi+json;version=2.1.0',
'application/vnd.aai.asyncapi+yaml;version=2.0.0',
'application/vnd.aai.asyncapi+yaml;version=2.1.0',
'application/schema;version=draft-07',

@@ -50,0 +53,0 @@ 'application/schema+json;version=draft-07',

2

lib/models/message-traitable.js

@@ -55,3 +55,3 @@ const { getMapValueOfType, mix } = require('./utils');

schemaFormat() {
return 'application/schema+json;version=draft-07';
return this._json.schemaFormat;
}

@@ -58,0 +58,0 @@

@@ -9,6 +9,5 @@ const path = require('path');

const { validateChannels, validateServerVariables, validateOperationId, validateServerSecurity } = require('./customValidators.js');
const { toJS, findRefs, getLocationOf, improveAjvErrors } = require('./utils');
const { toJS, findRefs, getLocationOf, improveAjvErrors, getDefaultSchemaFormat } = require('./utils');
const AsyncAPIDocument = require('./models/asyncapi');
const DEFAULT_SCHEMA_FORMAT = 'application/vnd.aai.asyncapi;version=2.0.0';
const OPERATIONS = ['publish', 'subscribe'];

@@ -191,9 +190,9 @@ //the only security types that can have a non empty array in the server security item

if (xParserMessageParsed in msg && msg[String(xParserMessageParsed)] === true) return;
const defaultSchemaFormat = getDefaultSchemaFormat(parsedAsyncAPIDocument.asyncapi);
const schemaFormat = msg.schemaFormat || defaultSchemaFormat;
const schemaFormat = msg.schemaFormat || DEFAULT_SCHEMA_FORMAT;
await PARSERS[String(schemaFormat)]({
schemaFormat,
message: msg,
defaultSchemaFormat: DEFAULT_SCHEMA_FORMAT,
defaultSchemaFormat,
originalAsyncAPIDocument,

@@ -205,3 +204,3 @@ parsedAsyncAPIDocument,

msg.schemaFormat = DEFAULT_SCHEMA_FORMAT;
msg.schemaFormat = defaultSchemaFormat;
msg[String(xParserMessageParsed)] = true;

@@ -208,0 +207,0 @@ }

@@ -287,1 +287,12 @@ const YAML = require('js-yaml');

};
/**
* returns default schema format for a given asyncapi version
*
* @function getDefaultSchemaFormat
* @private
* @param {String} asyncapiVersion AsyncAPI spec version.
*/
utils.getDefaultSchemaFormat = (asyncapiVersion) => {
return `application/vnd.aai.asyncapi;version=${asyncapiVersion}`;
};
{
"name": "@asyncapi/parser",
"version": "1.6.0-2021-06-release.1",
"version": "1.6.0-2021-06-release.2",
"description": "JavaScript AsyncAPI parser.",

@@ -71,3 +71,3 @@ "main": "lib/index.js",

"@apidevtools/json-schema-ref-parser": "^9.0.6",
"@asyncapi/specs": "2.8.0-2021-06-release.3",
"@asyncapi/specs": "2.8.0-2021-06-release.5",
"@fmvilas/pseudo-yaml-ast": "^0.3.1",

@@ -74,0 +74,0 @@ "ajv": "^6.10.1",

@@ -52,3 +52,3 @@ <h5 align="center">

const doc = await parser.parse(`
asyncapi: '2.0.0'
asyncapi: '2.1.0'
info:

@@ -55,0 +55,0 @@ title: Example

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc