Add URI Decoding to getRefObject.

This commit is contained in:
Brett Willemsen
2019-08-07 19:56:13 -04:00
parent c84e92d2eb
commit da9f54605b
2 changed files with 7 additions and 4 deletions

View File

@@ -1205,9 +1205,11 @@ module.exports = {
savedSchema = $ref.split('/').slice(1).map((elem) => {
// https://swagger.io/docs/specification/using-ref#escape
// since / is the default delimiter, slashes are escaped with ~1
return elem
.replace(/~1/g, '/')
.replace(/~0/g, '~');
return decodeURIComponent(
elem
.replace(/~1/g, '/')
.replace(/~0/g, '~')
);
});
// at this stage, savedSchema is [components, part1, parts]
// must have min. 2 segments after "#/components"