1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Jan Steemann 2014-11-18 14:16:48 +01:00
commit 2dcd5f7486
3 changed files with 33 additions and 6 deletions

View File

@ -32,6 +32,8 @@ v2.3.0 (XXXX-XX-XX)
* dynamically create extra dispatcher threads if required
* fixed issue #1097: schemas in the API docs no longer show required properties as optional
v2.3.0-beta2 (2014-11-08)
-------------------------

View File

@ -161,39 +161,43 @@ _.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
_.each(this.attributes, function (attribute, attributeName) {
var jsonSchema = {};
if (typeof attribute === 'string') {
properties[attributeName] = {type: attribute};
jsonSchema.type = attribute;
} else if (attribute) {
if (typeof attribute.type === 'string') {
properties[attributeName] = {type: attribute.type};
jsonSchema.type = attribute.type;
}
if (attribute.required) {
required.push(attributeName);
jsonSchema.required = true;
}
}
properties[attributeName] = jsonSchema;
});
}

View File

@ -255,6 +255,27 @@ function transactionInvocationSuite () {
}
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: nesting
////////////////////////////////////////////////////////////////////////////////
testNestingEmbedFlag : function () {
var obj = {
collections : {
},
action : function () {
return 19 + TRANSACTION({
collections: {
},
embed: true,
action: "function () { return 23; }"
});
}
};
assertEqual(42, TRANSACTION(obj));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: params
////////////////////////////////////////////////////////////////////////////////