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.0.0-rc.3 to 1.0.0-rc.4

12

lib/parser.js

@@ -18,3 +18,2 @@ const path = require('path');

const xParserCircle = 'x-parser-circular';
const refParser = new $RefParser;

@@ -80,6 +79,7 @@ /**

const refParser = new $RefParser;
//because of Ajv lacks support for circular refs, parser should not resolve them before Ajv validation and first needs to ignore them and leave circular $refs to successfully validate the document
//this is done pair to advice from Ajv creator https://github.com/ajv-validator/ajv/issues/1122#issuecomment-559378449
//later we perform full dereference of circular refs if they occure
await dereference(parsedJSON, initialFormat, asyncapiYAMLorJSON, { ...options, dereference: { circular: 'ignore' } });
await dereference(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, { ...options, dereference: { circular: 'ignore' } });

@@ -105,3 +105,3 @@ const ajv = new Ajv({

await customDocumentOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options);
if (refParser.$refs.circular) await handleCircularRefs(parsedJSON, initialFormat, asyncapiYAMLorJSON, options);
if (refParser.$refs.circular) await handleCircularRefs(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, options);
} catch (e) {

@@ -142,3 +142,3 @@ if (e instanceof ParserError) throw e;

async function dereference(parsedJSON, initialFormat, asyncapiYAMLorJSON, options) {
async function dereference(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, options) {
try {

@@ -165,4 +165,4 @@ return await refParser.dereference(options.path, parsedJSON, {

*/
async function handleCircularRefs(parsedJSON, initialFormat, asyncapiYAMLorJSON, options) {
await dereference(parsedJSON, initialFormat, asyncapiYAMLorJSON, { ...options, dereference: { circular: true } });
async function handleCircularRefs(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, options) {
await dereference(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, { ...options, dereference: { circular: true } });
//mark entire document as containing circular references

@@ -169,0 +169,0 @@ parsedJSON[String(xParserCircle)] = true;

{
"name": "@asyncapi/parser",
"version": "1.0.0-rc.3",
"version": "1.0.0-rc.4",
"description": "JavaScript AsyncAPI parser.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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