diff --git a/openapi-to-har.js b/openapi-to-har.js index 5ca81c4..582969a 100644 --- a/openapi-to-har.js +++ b/openapi-to-har.js @@ -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,