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"

View File

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