lib/framework.js
function Framework(spec, options) {
  if (!(this instanceof Framework)) {
    return new Framework(spec, options);
  }

  debug('create framework', spec, options);

  spec = lodash.cloneDeep(spec || {});
  options = lodash.cloneDeep(options || {});

  spec = lodash.defaults(spec, {
    swaggerVersion: '1.2',
    apis: [],
  });

  options = lodash.defaults(options,
    lodash.pick(spec, 'basePath')
  );
  delete spec.basePath;

  schema.validateThrow('ResourceListing', spec);
  schema.validateThrow(frameworkOptions, options);

  if (spec.swaggerVersion !== '1.2') {
    throw new Error('swaggerVersion not supported: ' + spec.swaggerVersion);
  }

  this.spec = spec;
  this.options = options;
  this.docs = new Docs(this);
  this.router = new Router(this);

  this.apis = {};
  this.middleware = {};
}
function Framework(spec, options) {
  if (!(this instanceof Framework)) {
    return new Framework(spec, options);
  }

  debug('create framework', spec, options);

  spec = lodash.cloneDeep(spec || {});
  options = lodash.cloneDeep(options || {});

  spec = lodash.defaults(spec, {
    swaggerVersion: '1.2',
    apis: [],
  });

  options = lodash.defaults(options,
    lodash.pick(spec, 'basePath')
  );
  delete spec.basePath;

  schema.validateThrow('ResourceListing', spec);
  schema.validateThrow(frameworkOptions, options);

  if (spec.swaggerVersion !== '1.2') {
    throw new Error('swaggerVersion not supported: ' + spec.swaggerVersion);
  }

  this.spec = spec;
  this.options = options;
  this.docs = new Docs(this);
  this.router = new Router(this);

  this.apis = {};
  this.middleware = {};
}
function Framework ( spec , options ) { if ( ! ( this instanceof Framework ) ) { return new Framework ( spec , options ) ; } debug ( 'create framework' , spec , options ) ; spec = lodash . cloneDeep ( spec || { } ) ; options = lodash . cloneDeep ( options || { } ) ; spec = lodash . defaults ( spec , { swaggerVersion : '1.2' , apis : [ ] , } ) ; options = lodash . defaults ( options , lodash . pick ( spec , 'basePath' ) ) ; delete spec . basePath ; schema . validateThrow ( 'ResourceListing' , spec ) ; schema . validateThrow ( frameworkOptions , options ) ; if ( spec . swaggerVersion !== '1.2' ) { throw new Error ( 'swaggerVersion not supported: ' + spec . swaggerVersion ) ; } this . spec = spec ; this . options = options ; this . docs = new Docs ( this ) ; this . router = new Router ( this ) ; this . apis = { } ; this . middleware = { } ; }
Initialize a new `Framework`.

@param {Object} spec
@param {Object} options
@api public
Initialize a new Framework .