code: function makeValidator(spec) {
    const props = 'header query params body'.split(' ');
  
    return async function validator(ctx, next) {
      if (!spec.validate) return await next();
  
      let err;
  
      for (let i = 0; i < props.length; ++i) {
        const prop = props[i];
  
        if (spec.validate[prop]) {
          err = validateInput(prop, ctx, spec.validate);
  
          if (err) {
            captureError(ctx, prop, err);
            if (!spec.validate.continueOnError) return ctx.throw(err);
          }
        }
      }
  
      await next();
  
      if (spec.validate._outputValidator) {
        debug('validating output');
  
        err = spec.validate._outputValidator.validate(ctx);
        if (err) {
          err.status = 500;
          return ctx.throw(err);
        }
      }
    };
  }
docs: Creates validator middleware.
  
  @param {Object} spec
  @return {async function}
  @api private