mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Add scenario referenced path points to local schema
Add scenario referenced path points to local schema
This commit is contained in:
@@ -26,7 +26,8 @@ let path = require('path'),
|
||||
'securitySchemes',
|
||||
'links',
|
||||
'callbacks'
|
||||
];
|
||||
],
|
||||
deref = require('./deref.js');
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,9 +138,7 @@ function getContentFromTrace(content, partial) {
|
||||
partial = partial[0] === jsonPointerLevelSeparator ? partial.substring(1) : partial;
|
||||
const trace = partial.split(jsonPointerLevelSeparator);
|
||||
let currentValue = content;
|
||||
for (let place of trace) {
|
||||
currentValue = currentValue[place];
|
||||
}
|
||||
currentValue = deref._getEscaped(content, trace, undefined);
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
@@ -351,7 +350,13 @@ function generateComponentsObject (documentContext, rootContent, refTypeResolver
|
||||
refData.inline = refData.keyInComponents.length === 0;
|
||||
}
|
||||
if (local) {
|
||||
refData.nodeContent = getContentFromTrace(refData.nodeContent, local);
|
||||
let contentFromTrace = getContentFromTrace(refData.nodeContent, local);
|
||||
if (!contentFromTrace) {
|
||||
refData.nodeContent = { $ref: `${localPointer + local}` };
|
||||
}
|
||||
else {
|
||||
refData.nodeContent = contentFromTrace;
|
||||
}
|
||||
}
|
||||
if (refData.inline) {
|
||||
refData.node = refData.nodeContent;
|
||||
|
||||
Reference in New Issue
Block a user