Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions openapi-to-har.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,25 @@ const resolveRef = function (openApi, ref) {
if (index + 1 < parts.length) {
// index = 1
let newCount = index + 1;
return recursive(obj[parts[index]], newCount);
return recursive(obj[replaceCharacter(parts[index])], newCount);
} else {
return obj[parts[index]];
return obj[replaceCharacter(parts[index])];
}
};
return recursive(openApi, 1);
};

/**
* Replace escape character
* https://swagger.io/docs/specification/using-ref/
*
* @param {string} refParts A reference string
* @return {string}
*/
const replaceCharacter = function (refParts) {
return refParts.replaceAll('~0', '~').replaceAll('~1', '/');
}

module.exports = {
getAll: openApiToHarList,
getEndpoint: createHar,
Expand Down