src/index.js
function generateApplicationCode(swagger, codegenOptions) {
  debug('Generating application code.');

  // Build up the execution parameters for the templates.
  const templateFunc = codegenOptions.templateSet;
  const outputDirectory = codegenOptions.temporaryDirectory;
  const codegenSettings = defaults(
    templateFunc(codegenOptions.templateSettings),
    {
      output: (name, content) => {
        const fullName = path.join(outputDirectory, name);
        const parsed = path.parse(fullName);
        mkdirp.sync(parsed.dir);
        fs.writeFileSync(fullName, content);
      },
      swagger: JSON.parse(JSON.stringify(swagger)), // Clone to avoid issues
    });

  // Perform the actual code generation
  codegen(codegenSettings);
}
function generateApplicationCode(swagger, codegenOptions) {
  debug('Generating application code.');

  // Build up the execution parameters for the templates.
  const templateFunc = codegenOptions.templateSet;
  const outputDirectory = codegenOptions.temporaryDirectory;
  const codegenSettings = defaults(
    templateFunc(codegenOptions.templateSettings),
    {
      output: (name, content) => {
        const fullName = path.join(outputDirectory, name);
        const parsed = path.parse(fullName);
        mkdirp.sync(parsed.dir);
        fs.writeFileSync(fullName, content);
      },
      swagger: JSON.parse(JSON.stringify(swagger)), // Clone to avoid issues
    });

  // Perform the actual code generation
  codegen(codegenSettings);
}
function generateApplicationCode ( swagger , codegenOptions ) { debug ( 'Generating application code.' ) ; // Build up the execution parameters for the templates. const templateFunc = codegenOptions . templateSet ; const outputDirectory = codegenOptions . temporaryDirectory ; const codegenSettings = defaults ( templateFunc ( codegenOptions . templateSettings ) , { output : ( name , content ) => { const fullName = path . join ( outputDirectory , name ) ; const parsed = path . parse ( fullName ) ; mkdirp . sync ( parsed . dir ) ; fs . writeFileSync ( fullName , content ) ; } , swagger : JSON . parse ( JSON . stringify ( swagger ) ) , // Clone to avoid issues } ) ; // Perform the actual code generation codegen ( codegenSettings ) ; }
Generate the application code in the specified temporary directory.
Generate the application code in the specified temporary directory .