Controller.js
function generatePropertyDefinition(name, path, definitionName) {
    var property = {};
    var type = path.options.type ? swagger20TypeFor(path.options.type) : 'string'; // virtuals don't have type

    if (skipProperty(name, path, controller)) {
      return;
    }
    // Configure the property
    if (path.options.type === mongoose.Schema.Types.ObjectId) {
      if ("_id" === name) {
        property.type = 'string';
      }
      else if (path.options.ref) {
        property.$ref = '#/definitions/' + utils.capitalize(path.options.ref);  
      }
    }
    else if (path.schema) {
      //Choice (1. embed schema here or 2. reference and publish as a root definition)
      property.type = 'array';        
      property.items = {
        //2. reference 
        $ref: '#/definitions/'+ definitionName + utils.capitalize(name)
      };       
    }
    else {
      property.type = type;
	  if ('array' === type) {
	    if (isArrayOfRefs(path.options.type)) {
  		  property.items = {
  		    type: 'string'  //handle references as string (serialization for objectId)
  		  };    
  		}
      else {
        var resolvedType = referenceForType(path.options.type); 
        if (resolvedType.isPrimitive) {
          property.items = {
            type: resolvedType.type
          };              
        }
        else {
          property.items = {
            $ref: resolvedType.type
          };              
        }
      }
	  }
      var format = swagger20TypeFormatFor(path.options.type);
      if (format) {
        property.format = format;
      }
      if ('__v' === name) {
        property.format = 'int32';
      }           
    }

	/*
    // Set enum values if applicable
    if (path.enumValues && path.enumValues.length > 0) {
      // Pending:  property.allowableValues = { valueType: 'LIST', values: path.enumValues };
    }
    // Set allowable values range if min or max is present
    if (!isNaN(path.options.min) || !isNaN(path.options.max)) {
      // Pending: property.allowableValues = { valueType: 'RANGE' };
    }
    if (!isNaN(path.options.min)) {
      // Pending: property.allowableValues.min = path.options.min;
    }
    if (!isNaN(path.options.max)) {
      // Pending: property.allowableValues.max = path.options.max;
    }
	*/
    if (!property.type && !property.$ref) {
      warnInvalidType(name, path);
      property.type = 'string';
    }
    return property;
  }
function generatePropertyDefinition(name, path, definitionName) {
    var property = {};
    var type = path.options.type ? swagger20TypeFor(path.options.type) : 'string'; // virtuals don't have type

    if (skipProperty(name, path, controller)) {
      return;
    }
    // Configure the property
    if (path.options.type === mongoose.Schema.Types.ObjectId) {
      if ("_id" === name) {
        property.type = 'string';
      }
      else if (path.options.ref) {
        property.$ref = '#/definitions/' + utils.capitalize(path.options.ref);  
      }
    }
    else if (path.schema) {
      //Choice (1. embed schema here or 2. reference and publish as a root definition)
      property.type = 'array';        
      property.items = {
        //2. reference 
        $ref: '#/definitions/'+ definitionName + utils.capitalize(name)
      };       
    }
    else {
      property.type = type;
	  if ('array' === type) {
	    if (isArrayOfRefs(path.options.type)) {
  		  property.items = {
  		    type: 'string'  //handle references as string (serialization for objectId)
  		  };    
  		}
      else {
        var resolvedType = referenceForType(path.options.type); 
        if (resolvedType.isPrimitive) {
          property.items = {
            type: resolvedType.type
          };              
        }
        else {
          property.items = {
            $ref: resolvedType.type
          };              
        }
      }
	  }
      var format = swagger20TypeFormatFor(path.options.type);
      if (format) {
        property.format = format;
      }
      if ('__v' === name) {
        property.format = 'int32';
      }           
    }

	/*
    // Set enum values if applicable
    if (path.enumValues && path.enumValues.length > 0) {
      // Pending:  property.allowableValues = { valueType: 'LIST', values: path.enumValues };
    }
    // Set allowable values range if min or max is present
    if (!isNaN(path.options.min) || !isNaN(path.options.max)) {
      // Pending: property.allowableValues = { valueType: 'RANGE' };
    }
    if (!isNaN(path.options.min)) {
      // Pending: property.allowableValues.min = path.options.min;
    }
    if (!isNaN(path.options.max)) {
      // Pending: property.allowableValues.max = path.options.max;
    }
	*/
    if (!property.type && !property.$ref) {
      warnInvalidType(name, path);
      property.type = 'string';
    }
    return property;
  }
function generatePropertyDefinition ( name , path , definitionName ) { var property = { } ; var type = path . options . type ? swagger20TypeFor ( path . options . type ) : 'string' ; // virtuals don't have type if ( skipProperty ( name , path , controller ) ) { return ; } // Configure the property if ( path . options . type === mongoose . Schema . Types . ObjectId ) { if ( "_id" === name ) { property . type = 'string' ; } else if ( path . options . ref ) { property . $ref = '#/definitions/' + utils . capitalize ( path . options . ref ) ; } } else if ( path . schema ) { //Choice (1. embed schema here or 2. reference and publish as a root definition) property . type = 'array' ; property . items = { //2. reference  $ref : '#/definitions/' + definitionName + utils . capitalize ( name ) } ; } else { property . type = type ; if ( 'array' === type ) { if ( isArrayOfRefs ( path . options . type ) ) { property . items = { type : 'string' //handle references as string (serialization for objectId) } ; } else { var resolvedType = referenceForType ( path . options . type ) ; if ( resolvedType . isPrimitive ) { property . items = { type : resolvedType . type } ; } else { property . items = { $ref : resolvedType . type } ; } } } var format = swagger20TypeFormatFor ( path . options . type ) ; if ( format ) { property . format = format ; } if ( '__v' === name ) { property . format = 'int32' ; } } /*
    // Set enum values if applicable
    if (path.enumValues && path.enumValues.length > 0) {
      // Pending:  property.allowableValues = { valueType: 'LIST', values: path.enumValues };
    }
    // Set allowable values range if min or max is present
    if (!isNaN(path.options.min) || !isNaN(path.options.max)) {
      // Pending: property.allowableValues = { valueType: 'RANGE' };
    }
    if (!isNaN(path.options.min)) {
      // Pending: property.allowableValues.min = path.options.min;
    }
    if (!isNaN(path.options.max)) {
      // Pending: property.allowableValues.max = path.options.max;
    }
	*/ if ( ! property . type && ! property . $ref ) { warnInvalidType ( name , path ) ; property . type = 'string' ; } return property ; }
A method used to generated a Swagger property for a model
A method used to generated a Swagger property for a model