Skip to content

Commit

Permalink
Ignore non-swagger params
Browse files Browse the repository at this point in the history
Plus fixes
  • Loading branch information
pibi committed Aug 23, 2021
1 parent 4968fb7 commit c046886
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AjvValidator extends BaseValidator {
constructor (options) {
super()
this.validator = new Ajv(options)
addFormats(ajv)
addFormats(this.validator)
}

compile (schema) {
Expand All @@ -32,6 +32,7 @@ class AjvValidator extends BaseValidator {
return function validatorMiddleware(handler, action) {
// Wrap a param validator
if (action.params && typeof action.params === "object") {
if (!action.params.openApi && !action.params.swagger) { return handler; }
const check = this.compile(action.params);
return async function validateContextParams(ctx) {
let res = await check(ctx.params != null ? ctx.params : {});
Expand Down

0 comments on commit c046886

Please sign in to comment.