@asyncapi/parser
Advanced tools
Comparing version 1.4.5 to 1.5.0
@@ -75,3 +75,3 @@ const {xParserMessageName, xParserSchemaId} = require('./constants'); | ||
messages.forEach(m => { | ||
if (m.name() === undefined) { | ||
if (m.name() === undefined && m.ext(xParserMessageName) === undefined) { | ||
m.json()[String(xParserMessageName)] = `<anonymous-message-${number}>`; | ||
@@ -78,0 +78,0 @@ } |
@@ -0,1 +1,2 @@ | ||
const xParserSpecParsed = 'x-parser-spec-parsed'; | ||
const xParserMessageName = 'x-parser-message-name'; | ||
@@ -5,3 +6,5 @@ const xParserSchemaId = 'x-parser-schema-id'; | ||
const xParserCircleProps = 'x-parser-circular-props'; | ||
module.exports = { | ||
xParserSpecParsed, | ||
xParserMessageName, | ||
@@ -8,0 +11,0 @@ xParserSchemaId, |
@@ -11,3 +11,3 @@ const { createMapOfType, getMapValueOfType, mix } = require('./utils'); | ||
const MixinSpecificationExtensions = require('../mixins/specification-extensions'); | ||
const {xParserCircle, xParserCircleProps} = require('../constants'); | ||
const {xParserSpecParsed, xParserCircle, xParserCircleProps} = require('../constants'); | ||
const {assignNameToAnonymousMessages, assignNameToComponentMessages, assignUidToComponentSchemas, assignUidToParameterSchemas, assignIdToAnonymousSchemas} = require('../anonymousNaming'); | ||
@@ -27,7 +27,14 @@ const {traverseAsyncApiDocument, SchemaIteratorCallbackType} = require('../iterators'); | ||
class AsyncAPIDocument extends Base { | ||
/** | ||
* @constructor | ||
*/ | ||
constructor(...args) { | ||
super(...args); | ||
if (this.ext(xParserSpecParsed) === true) { | ||
return; | ||
} | ||
assignNameToComponentMessages(this); | ||
assignNameToAnonymousMessages(this); | ||
assignNameToComponentMessages(this); | ||
@@ -38,2 +45,7 @@ markCircularSchemas(this); | ||
assignIdToAnonymousSchemas(this); | ||
// We add `x-parser-spec-parsed=true` extension to determine that the specification is parsed and validated | ||
// and when the specification is re-passed to the AsyncAPIDocument constructor, | ||
// there is no need to perform the same operations. | ||
this.json()[String(xParserSpecParsed)] = true; | ||
} | ||
@@ -40,0 +52,0 @@ |
{ | ||
"name": "@asyncapi/parser", | ||
"version": "1.4.5", | ||
"version": "1.5.0", | ||
"description": "JavaScript AsyncAPI parser.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -144,2 +144,5 @@ /** | ||
} | ||
/** | ||
* Implements functions to deal with the AsyncAPI document. | ||
*/ | ||
class AsyncAPIDocument extends Base implements MixinTags, MixinExternalDocs, MixinSpecificationExtensions { | ||
@@ -146,0 +149,0 @@ version(): string; |
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
1147811
7115