How to use the swagger-client.SwaggerClient function in swagger-client

To help you get started, we’ve selected a few swagger-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apigee-127 / bagpipes / lib / fittingTypes / swagger.js View on Github external
module.exports = function createFitting(pipes, fittingDef) {

  assert(fittingDef.url, util.format('url is required on fitting: %j', fittingDef));

  var client = require('swagger-client');
  var swagger = new client.SwaggerClient({
    url: fittingDef.url,
    success: function() {
      debug('swaggerjs initialized');
    },
    failure: function(err) {
      console.log('swaggerjs', err); // todo: what?
    },
    progress: function(msg) {
      debug('swaggerjs', msg);
    }
  });
  swagger.build();

  return function(context, next) {
    var api = swagger.apis[context.input.api];
    var operation = api[context.input.operation];