diff --git a/lib/helpers.js b/lib/helpers.js index 8b61beb..2e77063 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -577,11 +577,11 @@ module.exports.validateContentType = function (contentType, supportedTypes, resu module.exports.constructSchemaPathFromPtr = function (ptr, schema) { var refs = JsonRefs.pathFromPtr(ptr) - var paths = [] + var paths = []; refs.forEach(function (element) { - element = escapeSingleQuotes(element) - paths.push(element) + element = escapeSingleQuotes(element); + paths.push(element); }); var schemaPath = "['" + paths.join("']['") + "']"; @@ -631,5 +631,5 @@ var walk = module.exports.walk = function (obj, fn) { * @returns {string} - The already escaped string */ var escapeSingleQuotes = module.exports.escapeSingleQuotes = function (value) { - return value.split("'").join('%27') + return value.split("'").join('%27'); } \ No newline at end of file diff --git a/lib/types/parameter-value.js b/lib/types/parameter-value.js index a61b248..e9c9e88 100644 --- a/lib/types/parameter-value.js +++ b/lib/types/parameter-value.js @@ -126,7 +126,7 @@ function ParameterValue (parameterObject, raw) { if (!skipValidation) { // Validate against JSON Schema schemaObj = parameterObject.pathObject.api.definition; - schemaObj = escapePaths(schemaObj) + schemaObj = escapePaths(schemaObj); schemaPath = helpers.constructSchemaPathFromPtr(parameterObject.ptr, parameterObject.definition.schema); result = helpers.validateAgainstSchema(helpers.getJSONSchemaValidator(), schemaObj, value, schemaPath); } @@ -229,7 +229,7 @@ function escapePaths (schema) { _.each(schema['paths'], function (value, key) { schema['paths'][helpers.escapeSingleQuotes(key)] = value; }) - return schema + return schema; } module.exports = ParameterValue; \ No newline at end of file diff --git a/lib/types/parameter.js b/lib/types/parameter.js index 687acb3..c480cee 100644 --- a/lib/types/parameter.js +++ b/lib/types/parameter.js @@ -175,8 +175,8 @@ Parameter.prototype.getValue = function (req) { if (_.isUndefined(req.originalUrl) && _.isUndefined(req.url)) { throw new Error('req.originalUrl or req.url must be provided for \'path\' parameters'); } - urlObj.pathname = decodeURIComponent(urlObj.pathname) - urlObj.path = decodeURIComponent(urlObj.path) + urlObj.pathname = decodeURIComponent(urlObj.pathname); + urlObj.path = decodeURIComponent(urlObj.path); if (this.pathObject.hostTemplate) { // hostname needs to be a part of the data for doing the regex match while processing // x-ms-parameterized-host extension.