lib/framework/middleware.js
function query(ctx) {
  var prefix = describe(ctx);
  var schema = transform.parameters(ctx.operation.spec, 'query');

  if (!schema) {
    debug(prefix + 'query middleware disabled (no schema)');
    return;
  }

  var env = ctx.operation.resource.api.env;
  var options = validateOptions(ctx.operation, 'query', true);

  schema = {
    type: 'object',
    properties: { query: schema },
    required: ['query'],
  };

  return function(req, res, next) {
    var query = lodash.clone(req.sf.url.query);

    if (validate(res, env.validate(schema, { query: query }, options))) {
      req.sf.query = query;
      next();
    }
  };
}
function query(ctx) {
  var prefix = describe(ctx);
  var schema = transform.parameters(ctx.operation.spec, 'query');

  if (!schema) {
    debug(prefix + 'query middleware disabled (no schema)');
    return;
  }

  var env = ctx.operation.resource.api.env;
  var options = validateOptions(ctx.operation, 'query', true);

  schema = {
    type: 'object',
    properties: { query: schema },
    required: ['query'],
  };

  return function(req, res, next) {
    var query = lodash.clone(req.sf.url.query);

    if (validate(res, env.validate(schema, { query: query }, options))) {
      req.sf.query = query;
      next();
    }
  };
}
function query ( ctx ) { var prefix = describe ( ctx ) ; var schema = transform . parameters ( ctx . operation . spec , 'query' ) ; if ( ! schema ) { debug ( prefix + 'query middleware disabled (no schema)' ) ; return ; } var env = ctx . operation . resource . api . env ; var options = validateOptions ( ctx . operation , 'query' , true ) ; schema = { type : 'object' , properties : { query : schema } , required : [ 'query' ] , } ; return function ( req , res , next ) { var query = lodash . clone ( req . sf . url . query ) ; if ( validate ( res , env . validate ( schema , { query : query } , options ) ) ) { req . sf . query = query ; next ( ) ; } } ; }
Validate query based on Swagger spec.
Validate query based on Swagger spec .