diff --git a/js/server/modules/org/arangodb/foxx/model.js b/js/server/modules/org/arangodb/foxx/model.js index 079b398929..d3c676ecb8 100644 --- a/js/server/modules/org/arangodb/foxx/model.js +++ b/js/server/modules/org/arangodb/foxx/model.js @@ -161,25 +161,26 @@ _.extend(Model, { if (this.prototype.schema) { _.each(this.prototype.schema, function (schema, attributeName) { var description = schema.describe(), - type = description.type, + jsonSchema = {type: description.type}, rules = description.rules, flags = description.flags; if (flags && flags.presence === 'required') { + jsonSchema.required = true; required.push(attributeName); } if ( - type === 'number' && + jsonSchema.type === 'number' && _.isArray(rules) && _.some(rules, function (rule) { return rule.name === 'integer'; }) ) { - type = 'integer'; + jsonSchema.type = 'integer'; } - properties[attributeName] = {type: type}; + properties[attributeName] = jsonSchema; }); } else { // deprecated