Skip to content

Commit

Permalink
Merge pull request #2 from taxfix/bruce/fix-apply-restify-7
Browse files Browse the repository at this point in the history
fix: allow for restify <7 as well as restify 7
  • Loading branch information
freakyfelt authored Mar 31, 2023
2 parents 97d205c + 6b6eb6d commit 35b4f8f
Show file tree
Hide file tree
Showing 4 changed files with 470 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports.validationPlugin = function (options) {
options.validatorModels = _.extend.apply(null, validatorModels);
}
return function (req, res, next) {
var validationModel = req.route ? req.route.validation : undefined;
var validationModel = req.route?.spec?.validation || req.route?.validation || undefined;

if (validationModel) {
// validate
Expand Down
222 changes: 222 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"devDependencies": {
"restify": ">=2.8.1 <5.0.0",
"restify7": "npm:[email protected]",
"mocha": "3.1.x",
"sinon": "1.11.x",
"should": "11.1.x",
Expand Down
Loading

0 comments on commit 35b4f8f

Please sign in to comment.