mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
solvin conflicts in tests
This commit is contained in:
@@ -56,10 +56,7 @@ function removeLocalReferenceFromPath(refValue) {
|
||||
*/
|
||||
function calculatePath(parentFileName, referencePath) {
|
||||
let currentDirName = path.dirname(parentFileName),
|
||||
fileDirName = path.dirname(referencePath),
|
||||
refDirName = currentDirName === fileDirName ?
|
||||
referencePath :
|
||||
path.join(currentDirName, referencePath);
|
||||
refDirName = path.join(currentDirName, referencePath);
|
||||
return refDirName;
|
||||
}
|
||||
|
||||
@@ -191,10 +188,9 @@ function setValueInComponents(keyInComponents, components, value) {
|
||||
* Return a trace from the current node's root to the place where we find a $ref
|
||||
* @param {object} nodeContext - The current node we are processing
|
||||
* @param {object} property - The current property that contains the $ref
|
||||
* @param {string} parentFilename - The parent's filename
|
||||
* @returns {array} The trace to the place where the $ref appears
|
||||
*/
|
||||
function getTraceFromParentKeyInComponents(nodeContext, property, parentFilename) {
|
||||
function getTraceFromParentKeyInComponents(nodeContext, property) {
|
||||
const parents = [...nodeContext.parents].reverse(),
|
||||
isArrayKeyRegexp = new RegExp('^\\d$', 'g'),
|
||||
key = nodeContext.key,
|
||||
@@ -206,11 +202,7 @@ function getTraceFromParentKeyInComponents(nodeContext, property, parentFilename
|
||||
parentKeys :
|
||||
[key, ...parentKeys],
|
||||
nodeTrace = getRootFileTrace(nodeParentsKey),
|
||||
cleanFileName = (filename) => {
|
||||
const [file, local] = filename.split('#');
|
||||
return [calculatePath(parentFilename, file), local];
|
||||
},
|
||||
[file, local] = cleanFileName(property),
|
||||
[file, local] = property.split('#'),
|
||||
[keyTraceInComponents, inComponents] = getKeyInComponents(nodeTrace, file, local);
|
||||
return [keyTraceInComponents, inComponents];
|
||||
}
|
||||
@@ -238,7 +230,7 @@ function getReferences (currentNode, refTypeResolver, pathSolver, parentFilename
|
||||
);
|
||||
if (hasReferenceTypeKey) {
|
||||
const tempRef = calculatePath(parentFilename, property.$ref),
|
||||
[nodeTrace, inComponents] = getTraceFromParentKeyInComponents(this, tempRef, parentFilename),
|
||||
[nodeTrace, inComponents] = getTraceFromParentKeyInComponents(this, tempRef),
|
||||
referenceInDocument = getJsonPointerRelationToRoot(
|
||||
jsonPointerEncodeAndReplace,
|
||||
tempRef,
|
||||
|
||||
Reference in New Issue
Block a user