diff --git a/lib/buildroutes.js b/lib/buildroutes.js index 87b3ea9..9e1bbf6 100644 --- a/lib/buildroutes.js +++ b/lib/buildroutes.js @@ -53,12 +53,18 @@ function buildroutes(options) { if (def.parameters) { def.parameters.forEach(function (parameter) { + if (parameter.$ref) { + parameter = validator.refresolve(parameter.$ref); + } validators[parameter.in + parameter.name] = parameter; }); } if (operation.parameters) { operation.parameters.forEach(function (parameter) { + if (parameter.$ref) { + parameter = validator.refresolve(parameter.$ref); + } validators[parameter.in + parameter.name] = parameter; }); } diff --git a/lib/validator.js b/lib/validator.js index 97a1924..b191cef 100644 --- a/lib/validator.js +++ b/lib/validator.js @@ -43,6 +43,15 @@ module.exports = function validator(options) { }); return { + /** + * Get the object the path references. + * @param value + * @returns {*} + */ + refresolve: function(value) { + return refresolver(schemas, value); + }, + /** * Creates a parameter validator. * @param parameter