From a91eb2fb04356aae9349f5958e302ff625b27af0 Mon Sep 17 00:00:00 2001 From: Ying Tang Date: Tue, 7 Apr 2015 11:21:12 -0700 Subject: [PATCH] Convert array to string for summary, note, and description. Fix additionalProperties --- lib/class-helper.js | 3 ++- lib/model-helper.js | 11 +++++++---- lib/route-helper.js | 6 +++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/class-helper.js b/lib/class-helper.js index 573c3f5..e060d98 100644 --- a/lib/class-helper.js +++ b/lib/class-helper.js @@ -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 }; } }; diff --git a/lib/model-helper.js b/lib/model-helper.js index 1268941..4ea2eb9 100644 --- a/lib/model-helper.js +++ b/lib/model-helper.js @@ -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 diff --git a/lib/route-helper.js b/lib/route-helper.js index 8f73fb8..c615d93 100644 --- a/lib/route-helper.js +++ b/lib/route-helper.js @@ -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);