Avoid reporting local refs

Avoid reporting local refs
This commit is contained in:
Luis Tejeda
2022-04-22 11:01:56 -05:00
committed by Erik Mendoza
parent 2fea161d84
commit 4a38a70d0b
3 changed files with 46 additions and 5 deletions

View File

@@ -8,8 +8,11 @@ const traverseUtility = require('traverse'),
* @param {string} key - specified version of the process
* @returns {object} - Detect root files result object
*/
function isRef(obj, key) {
return key === '$ref' && typeof obj[key] === 'string' && obj[key] !== undefined;
function isExtRef(obj, key) {
return key === '$ref' &&
typeof obj[key] === 'string' &&
obj[key] !== undefined &&
!obj[key].startsWith('#');
}
/**
@@ -37,7 +40,7 @@ function getReferences (currentNode) {
hasReferenceTypeKey = Object.keys(property)
.find(
(key) => {
return isRef(property, key);
return isExtRef(property, key);
}
);
if (hasReferenceTypeKey) {