Controller.js
function swagger20TypeFor(type) {
    if (!type) { return null; }
    if (type === Number) { return 'number'; }
    if (type === Boolean) { return 'boolean'; }
    if (type === String || 
		type === Date ||
		type === mongoose.Schema.Types.ObjectId || 
		type === mongoose.Schema.Types.Oid) { 
		return 'string'; 
	}
    if (type === mongoose.Schema.Types.Array || 
		Array.isArray(type) || 
		type.name === "Array") { 
		return 'array'; 
	}
    if (type === Object  ||
		type instanceof Object ||
		type === mongoose.Schema.Types.Mixed ||
		type === mongoose.Schema.Types.Buffer) { 
		return null; 
	}
    throw new Error('Unrecognized type: ' + type);
  }
function swagger20TypeFor(type) {
    if (!type) { return null; }
    if (type === Number) { return 'number'; }
    if (type === Boolean) { return 'boolean'; }
    if (type === String || 
		type === Date ||
		type === mongoose.Schema.Types.ObjectId || 
		type === mongoose.Schema.Types.Oid) { 
		return 'string'; 
	}
    if (type === mongoose.Schema.Types.Array || 
		Array.isArray(type) || 
		type.name === "Array") { 
		return 'array'; 
	}
    if (type === Object  ||
		type instanceof Object ||
		type === mongoose.Schema.Types.Mixed ||
		type === mongoose.Schema.Types.Buffer) { 
		return null; 
	}
    throw new Error('Unrecognized type: ' + type);
  }
function swagger20TypeFor ( type ) { if ( ! type ) { return null ; } if ( type === Number ) { return 'number' ; } if ( type === Boolean ) { return 'boolean' ; } if ( type === String || type === Date || type === mongoose . Schema . Types . ObjectId || type === mongoose . Schema . Types . Oid ) { return 'string' ; } if ( type === mongoose . Schema . Types . Array || Array . isArray ( type ) || type . name === "Array" ) { return 'array' ; } if ( type === Object || type instanceof Object || type === mongoose . Schema . Types . Mixed || type === mongoose . Schema . Types . Buffer ) { return null ; } throw new Error ( 'Unrecognized type: ' + type ) ; }
Convert a Mongoose type into a Swagger type
Convert a Mongoose type into a Swagger type