Corrected prepareDataType() to handle collections and nesting, and changed to always and only use responseMessages
This commit is contained in:
parent
1eddcade09
commit
5ef5baee06
|
@ -122,7 +122,22 @@ var routeHelper = module.exports = {
|
|||
}
|
||||
|
||||
if(Array.isArray(type)) {
|
||||
return 'array'; // todo items support
|
||||
if (type.length > 0) {
|
||||
if (typeof type[0] === 'string') {
|
||||
return '[' + type[0] + ']';
|
||||
} else if (typeof type[0] === 'function') {
|
||||
return '[' + type[0].name + ']';
|
||||
} else if (typeof type[0] === 'object') {
|
||||
if (typeof type[0].type === 'function') {
|
||||
return '[' + type[0].type.name + ']';
|
||||
} else {
|
||||
return '[' + type[0].type + ']';
|
||||
}
|
||||
} else {
|
||||
return '[' + type + ']';
|
||||
}
|
||||
}
|
||||
return 'array';
|
||||
}
|
||||
|
||||
// TODO(schoon) - Add support for complex dataTypes, "models", etc.
|
||||
|
@ -175,10 +190,6 @@ var routeHelper = module.exports = {
|
|||
deprecated: route.deprecated,
|
||||
// [rfeng] Swagger UI doesn't escape '.' for jQuery selector
|
||||
nickname: route.method.replace(/\./g, '_'),
|
||||
// Per the spec:
|
||||
// https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#523-operation-object
|
||||
// This is the only object that may have a type of 'void'.
|
||||
type: returns.model || returns.type || 'void',
|
||||
summary: route.description, // TODO(schoon) - Excerpt?
|
||||
notes: route.notes, // TODO(schoon) - `description` metadata?
|
||||
consumes: ['application/json', 'application/xml', 'text/xml'],
|
||||
|
|
Loading…
Reference in New Issue