review comments

This commit is contained in:
Ying Tang 2015-04-08 17:03:22 -07:00
parent c001bd6b01
commit 7af616b21a
1 changed files with 11 additions and 10 deletions

View File

@ -97,7 +97,7 @@ var modelHelper = module.exports = {
delete prop.required;
delete prop.id;
if (prop.description) {
if (prop.description){
prop.description = Array.isArray(prop.description) ? prop.description.join('') : prop.description;
}
@ -120,26 +120,27 @@ var modelHelper = module.exports = {
}
});
out[name] = {
id: name
};
var additionalProperties = undefined;
if (def.settings){
var strict = def.settings.strict;
var additionalProperties = def.settings.additionalProperties;
additionalProperties = def.settings.additionalProperties;
var notAllowAdditionalProperties = strict || (additionalProperties !== true);
if (notAllowAdditionalProperties){
out[name].additionalProperties = !notAllowAdditionalProperties;
additionalProperties = false;
}
}
out[name] = {
id: name,
additionalProperties: additionalProperties,
properties: properties,
required: required
};
if (def.description){
out[name].description = Array.isArray(def.description) ? def.description.join('') : def.description;
}
out[name].properties = properties;
out[name].required = required;
// Generate model definitions for related models
for (var r in modelClass.relations) {
var rel = modelClass.relations[r];