mirror of https://gitee.com/bigwinds/arangodb
Also respect required props in legacy schemas. Fixes #1097.
This commit is contained in:
parent
0dbb3f3bf6
commit
a39d48cd0f
|
@ -184,16 +184,19 @@ _.extend(Model, {
|
|||
} 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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue