Skip to content

Commit

Permalink
Merge branch 'master' into fix_v3_support
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Sep 27, 2023
2 parents bbc6cb0 + cccd9fa commit f11ea47
Show file tree
Hide file tree
Showing 2 changed files with 1,132 additions and 34 deletions.
6 changes: 3 additions & 3 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ parser.sanitizeTemplateApiVersion = (apiVersion) => {

parser.parse = (asyncapi, oldOptions, generator) => {
let apiVersion = this.sanitizeTemplateApiVersion(generator.templateConfig.apiVersion);
// Defaulting to v1 parser to convert it to the old parserAPI afterwards.
// Defaulting to apiVersion v1 to convert it to the Parser-API v1 afterwards.
if (!this.usesNewAPI(generator.templateConfig)) {
apiVersion = '1';
}
Expand All @@ -26,7 +26,7 @@ parser.parse = (asyncapi, oldOptions, generator) => {
};

/**
* If the template expect one of the new parser API versions, it must be above 0
* If the template expect one of the Parser-API versions, it must be above 0
*/
parser.usesNewAPI = (templateConfig = {}) => {
return Number(this.sanitizeTemplateApiVersion(templateConfig.apiVersion)) > 0;
Expand All @@ -38,7 +38,7 @@ parser.usesNewAPI = (templateConfig = {}) => {
parser.getProperApiDocument = (asyncapiDocument, templateConfig = {}) => {
const apiVersion = this.sanitizeTemplateApiVersion(templateConfig.apiVersion);
if (apiVersion === undefined) {
// Convert to old version
// Convert to old API from JS Parser v1
return convertToOldAPI(asyncapiDocument);
}
return ConvertDocumentParserAPIVersion(asyncapiDocument, apiVersion);
Expand Down
Loading

0 comments on commit f11ea47

Please sign in to comment.