Corrected handling of type for operation, including containers
This commit is contained in:
parent
5fcc411c06
commit
3bd1e4440d
|
@ -187,9 +187,10 @@ var routeHelper = module.exports = {
|
||||||
// `items` and `format` fields.
|
// `items` and `format` fields.
|
||||||
operations: [routeHelper.extendWithType({
|
operations: [routeHelper.extendWithType({
|
||||||
method: routeHelper.convertVerb(route.verb),
|
method: routeHelper.convertVerb(route.verb),
|
||||||
deprecated: route.deprecated,
|
|
||||||
// [rfeng] Swagger UI doesn't escape '.' for jQuery selector
|
// [rfeng] Swagger UI doesn't escape '.' for jQuery selector
|
||||||
nickname: route.method.replace(/\./g, '_'),
|
nickname: route.method.replace(/\./g, '_'),
|
||||||
|
deprecated: route.deprecated,
|
||||||
|
type: returns.model || returns.type || 'void',
|
||||||
summary: route.description, // TODO(schoon) - Excerpt?
|
summary: route.description, // TODO(schoon) - Excerpt?
|
||||||
notes: route.notes, // TODO(schoon) - `description` metadata?
|
notes: route.notes, // TODO(schoon) - `description` metadata?
|
||||||
consumes: ['application/json', 'application/xml', 'text/xml'],
|
consumes: ['application/json', 'application/xml', 'text/xml'],
|
||||||
|
@ -295,6 +296,22 @@ var routeHelper = module.exports = {
|
||||||
Object.keys(typeDesc).forEach(function(key){
|
Object.keys(typeDesc).forEach(function(key){
|
||||||
obj[key] = typeDesc[key];
|
obj[key] = typeDesc[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Ensure brief properties are first
|
||||||
|
if (typeof obj === 'object') {
|
||||||
|
var keysToSink = ['authorizations', 'consumes', 'notes', 'produces',
|
||||||
|
'parameters', 'responseMessages', 'summary'];
|
||||||
|
var outKeys = Object.keys(obj);
|
||||||
|
for (var outKeyIdx in outKeys) {
|
||||||
|
var outKey = outKeys[outKeyIdx];
|
||||||
|
if (keysToSink.indexOf(outKey) != -1) {
|
||||||
|
var outValue = obj[outKey];
|
||||||
|
delete obj[outKey];
|
||||||
|
obj[outKey] = outValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue