src/definition-mapper.js
function mapDefinitionsFromModel(model) {
  const definitionMap = [];

  /* istanbul ignore else */
  if (model && model.definitions) {
    debug('Parsing %s definitions', Object.keys(model.definitions).length);
    for (const definitionName of Object.keys(model.definitions)) {
      debug('  Reading definition for %s', definitionName);
      const definitionKey = util.format('#/definitions/%s', definitionName);
      const currentDef = model.definitions[definitionName];
      currentDef.definitionName = definitionName;
      currentDef.referencePath = definitionKey;
      definitionMap[definitionKey] = currentDef;
    }
  }

  return definitionMap;
}
function mapDefinitionsFromModel(model) {
  const definitionMap = [];

  /* istanbul ignore else */
  if (model && model.definitions) {
    debug('Parsing %s definitions', Object.keys(model.definitions).length);
    for (const definitionName of Object.keys(model.definitions)) {
      debug('  Reading definition for %s', definitionName);
      const definitionKey = util.format('#/definitions/%s', definitionName);
      const currentDef = model.definitions[definitionName];
      currentDef.definitionName = definitionName;
      currentDef.referencePath = definitionKey;
      definitionMap[definitionKey] = currentDef;
    }
  }

  return definitionMap;
}
function mapDefinitionsFromModel ( model ) { const definitionMap = [ ] ; /* istanbul ignore else */ if ( model && model . definitions ) { debug ( 'Parsing %s definitions' , Object . keys ( model . definitions ) . length ) ; for ( const definitionName of Object . keys ( model . definitions ) ) { debug ( '  Reading definition for %s' , definitionName ) ; const definitionKey = util . format ( '#/definitions/%s' , definitionName ) ; const currentDef = model . definitions [ definitionName ] ; currentDef . definitionName = definitionName ; currentDef . referencePath = definitionKey ; definitionMap [ definitionKey ] = currentDef ; } } return definitionMap ; }
Map the definitions from a Swagger model
@param {object} model      - Swagger model
@return                    - Map of definition name to definition body
Map the definitions from a Swagger model