mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
2dcd5f7486
|
@ -32,6 +32,8 @@ v2.3.0 (XXXX-XX-XX)
|
||||||
|
|
||||||
* dynamically create extra dispatcher threads if required
|
* 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)
|
v2.3.0-beta2 (2014-11-08)
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
|
@ -161,39 +161,43 @@ _.extend(Model, {
|
||||||
if (this.prototype.schema) {
|
if (this.prototype.schema) {
|
||||||
_.each(this.prototype.schema, function (schema, attributeName) {
|
_.each(this.prototype.schema, function (schema, attributeName) {
|
||||||
var description = schema.describe(),
|
var description = schema.describe(),
|
||||||
type = description.type,
|
jsonSchema = {type: description.type},
|
||||||
rules = description.rules,
|
rules = description.rules,
|
||||||
flags = description.flags;
|
flags = description.flags;
|
||||||
|
|
||||||
if (flags && flags.presence === 'required') {
|
if (flags && flags.presence === 'required') {
|
||||||
|
jsonSchema.required = true;
|
||||||
required.push(attributeName);
|
required.push(attributeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
type === 'number' &&
|
jsonSchema.type === 'number' &&
|
||||||
_.isArray(rules) &&
|
_.isArray(rules) &&
|
||||||
_.some(rules, function (rule) {
|
_.some(rules, function (rule) {
|
||||||
return rule.name === 'integer';
|
return rule.name === 'integer';
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
type = 'integer';
|
jsonSchema.type = 'integer';
|
||||||
}
|
}
|
||||||
|
|
||||||
properties[attributeName] = {type: type};
|
properties[attributeName] = jsonSchema;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// deprecated
|
// deprecated
|
||||||
_.each(this.attributes, function (attribute, attributeName) {
|
_.each(this.attributes, function (attribute, attributeName) {
|
||||||
|
var jsonSchema = {};
|
||||||
if (typeof attribute === 'string') {
|
if (typeof attribute === 'string') {
|
||||||
properties[attributeName] = {type: attribute};
|
jsonSchema.type = attribute;
|
||||||
} else if (attribute) {
|
} else if (attribute) {
|
||||||
if (typeof attribute.type === 'string') {
|
if (typeof attribute.type === 'string') {
|
||||||
properties[attributeName] = {type: attribute.type};
|
jsonSchema.type = attribute.type;
|
||||||
}
|
}
|
||||||
if (attribute.required) {
|
if (attribute.required) {
|
||||||
required.push(attributeName);
|
required.push(attributeName);
|
||||||
|
jsonSchema.required = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
properties[attributeName] = jsonSchema;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
/// @brief test: params
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue