Convert array to string for summary, note, and description. Fix additionalProperties

This commit is contained in:
Ying Tang 2015-04-07 11:21:12 -07:00
parent 3f8c3b7c04
commit a91eb2fb04
3 changed files with 12 additions and 8 deletions

View File

@ -41,9 +41,10 @@ var classHelper = module.exports = {
* @return {Object} API declaration reference.
*/
generateResourceDocAPIEntry: function(aClass) {
var description = aClass.ctor.settings.description || aClass.ctor.sharedCtor && aClass.ctor.sharedCtor.description;
return {
path: aClass.http.path,
description: aClass.ctor.settings.description || aClass.ctor.sharedCtor && aClass.ctor.sharedCtor.description
description: Array.isArray(description) ? description.join('') : description
};
}
};

View File

@ -130,10 +130,13 @@ var modelHelper = module.exports = {
out[name].description = Array.isArray(def.description) ? def.description.join('') : def.description;
}
if (def.settings && typeof def.settings.strict != 'undefined') {
out[name].additionalProperties = !def.settings.strict;
} else if (def.settings && typeof def.settings.additionalProperties != 'undefined') {
out[name].additionalProperties = def.settings.additionalProperties;
if (def.settings){
var strict = def.settings.strict;
var additionalProperties = def.settings.additionalProperties;
var notAllowAdditionalProperties = strict || (additionalProperties !== true);
if (notAllowAdditionalProperties){
out[name].additionalProperties = !notAllowAdditionalProperties;
}
}
// Generate model definitions for related models

View File

@ -191,8 +191,8 @@ var routeHelper = module.exports = {
nickname: route.method.replace(/\./g, '_'),
deprecated: route.deprecated,
type: returns.model || returns.type || 'void',
summary: route.description, // TODO(schoon) - Excerpt?
notes: route.notes, // TODO(schoon) - `description` metadata?
summary: Array.isArray(route.description) ? route.description.join('') : route.description, // TODO(schoon) - Excerpt?
notes: Array.isArray(route.notes) ? route.notes.join('') : route.notes, // TODO(schoon) - `description` metadata?
consumes: ['application/json', 'application/xml', 'text/xml'],
produces: ['application/json', 'application/javascript', 'application/xml', 'text/javascript', 'text/xml'],
parameters: accepts,
@ -264,7 +264,7 @@ var routeHelper = module.exports = {
minimum: accepts.minimum,
maximum: accepts.maximum,
allowMultiple: accepts.allowMultiple,
description: accepts.description
description: Array.isArray(accepts.description) ? accepts.description.join('') : accepts.description
};
out = routeHelper.extendWithType(out);