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 {
|
} 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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue