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

View File

@@ -230,6 +230,7 @@ paths:
stype: form stype: form
schema: schema:
$ref: '#/components/parameters/Tuhin' $ref: '#/components/parameters/Tuhin'
- $ref: '#/paths/~1pets~1%7Bid%7D/get/parameters/0'
servers: servers:
- url: https://{username}.gigantic-server.com:{port}/{basePath} - url: https://{username}.gigantic-server.com:{port}/{basePath}
description: Common url for all operations in this path description: Common url for all operations in this path