packages/api-gateway/src/cli/create-model.js
function executeCommand(parameters) {
    // If a name has been provided, we create the project directory
    const modelFilePath = path.join(process.cwd(), plugin.config.modelsPath);
    return mkdirpAsync(modelFilePath)
    .then(() => {
      const model = {
        type: 'object',
        properties: {}
      };
      return fs.writeFileAsync(modelFilePath + path.sep + parameters.name + '.json', JSON.stringify(model, null, 2));
    })
    .then(() => {
      let msg = '\n  A new model has been created!\n\n';
      msg += '  Its Swagger specification is available in ' + icli.format.info(modelFilePath + path.sep + parameters.name + '.json') + '\n';
      icli.print(msg);
    });
  }
function executeCommand(parameters) {
    // If a name has been provided, we create the project directory
    const modelFilePath = path.join(process.cwd(), plugin.config.modelsPath);
    return mkdirpAsync(modelFilePath)
    .then(() => {
      const model = {
        type: 'object',
        properties: {}
      };
      return fs.writeFileAsync(modelFilePath + path.sep + parameters.name + '.json', JSON.stringify(model, null, 2));
    })
    .then(() => {
      let msg = '\n  A new model has been created!\n\n';
      msg += '  Its Swagger specification is available in ' + icli.format.info(modelFilePath + path.sep + parameters.name + '.json') + '\n';
      icli.print(msg);
    });
  }
function executeCommand ( parameters ) { // If a name has been provided, we create the project directory const modelFilePath = path . join ( process . cwd ( ) , plugin . config . modelsPath ) ; return mkdirpAsync ( modelFilePath ) . then ( ( ) => { const model = { type : 'object' , properties : { } } ; return fs . writeFileAsync ( modelFilePath + path . sep + parameters . name + '.json' , JSON . stringify ( model , null , 2 ) ) ; } ) . then ( ( ) => { let msg = '\n  A new model has been created!\n\n' ; msg += '  Its Swagger specification is available in ' + icli . format . info ( modelFilePath + path . sep + parameters . name + '.json' ) + '\n' ; icli . print ( msg ) ; } ) ; }
Create the new model
@param {Object} parameters - the parameters provided in the command and in the prompt
@returns {Promise<null>} - The execution stops here
Create the new model