Controller.js
function generateOperations (plural) {
    var operations = [];

    controller.methods().forEach(function (verb) {
      var operation = {};
      var titlePlural = capitalize(controller.model().plural());
      var titleSingular = capitalize(controller.model().singular());

      // Don't do head, post/put for single/plural
      if (verb === 'head') return;
      if (verb === 'post' && !plural) return;
      if (verb === 'put' && plural) return;

      // Use the full word
      if (verb === 'del') verb = 'delete';

      operation.httpMethod = verb.toUpperCase();

      if (plural) operation.nickname = verb + titlePlural;
      else operation.nickname = verb + titleSingular + 'ById';

      operation.responseClass = titleSingular; // TODO sometimes an array!

      if (plural) operation.summary = capitalize(verb) + ' some ' + controller.model().plural();
      else operation.summary = capitalize(verb) + ' a ' + controller.model().singular() + ' by its unique ID';

      operation.parameters = generateParameters(verb, plural);
      operation.errorResponses = generateErrorResponses(plural);

      operations.push(operation);
    });

    return operations;
  }
function generateOperations (plural) {
    var operations = [];

    controller.methods().forEach(function (verb) {
      var operation = {};
      var titlePlural = capitalize(controller.model().plural());
      var titleSingular = capitalize(controller.model().singular());

      // Don't do head, post/put for single/plural
      if (verb === 'head') return;
      if (verb === 'post' && !plural) return;
      if (verb === 'put' && plural) return;

      // Use the full word
      if (verb === 'del') verb = 'delete';

      operation.httpMethod = verb.toUpperCase();

      if (plural) operation.nickname = verb + titlePlural;
      else operation.nickname = verb + titleSingular + 'ById';

      operation.responseClass = titleSingular; // TODO sometimes an array!

      if (plural) operation.summary = capitalize(verb) + ' some ' + controller.model().plural();
      else operation.summary = capitalize(verb) + ' a ' + controller.model().singular() + ' by its unique ID';

      operation.parameters = generateParameters(verb, plural);
      operation.errorResponses = generateErrorResponses(plural);

      operations.push(operation);
    });

    return operations;
  }
function generateOperations ( plural ) { var operations = [ ] ; controller . methods ( ) . forEach ( function ( verb ) { var operation = { } ; var titlePlural = capitalize ( controller . model ( ) . plural ( ) ) ; var titleSingular = capitalize ( controller . model ( ) . singular ( ) ) ; // Don't do head, post/put for single/plural if ( verb === 'head' ) return ; if ( verb === 'post' && ! plural ) return ; if ( verb === 'put' && plural ) return ; // Use the full word if ( verb === 'del' ) verb = 'delete' ; operation . httpMethod = verb . toUpperCase ( ) ; if ( plural ) operation . nickname = verb + titlePlural ; else operation . nickname = verb + titleSingular + 'ById' ; operation . responseClass = titleSingular ; // TODO sometimes an array! if ( plural ) operation . summary = capitalize ( verb ) + ' some ' + controller . model ( ) . plural ( ) ; else operation . summary = capitalize ( verb ) + ' a ' + controller . model ( ) . singular ( ) + ' by its unique ID' ; operation . parameters = generateParameters ( verb , plural ) ; operation . errorResponses = generateErrorResponses ( plural ) ; operations . push ( operation ) ; } ) ; return operations ; }
Generate a list of a controller's operations
Generate a list of a controller s operations