Add options including default

This commit is contained in:
Raymond Feng 2013-05-28 15:40:16 -07:00
parent 2a15926318
commit 771bf70ec5
2 changed files with 9 additions and 1 deletions

View File

@ -416,7 +416,14 @@ function buildSchema(name, properties, associations) {
});
delete properties[p];
} else {
properties[p] = type;
var typeDef = {
type: type
};
delete properties[p].type;
for(var a in properties[p]) {
typeDef[a] = properties[p][a];
}
properties[p] = typeDef;
}
}
return properties;

View File

@ -179,6 +179,7 @@ describe('Load models from json', function () {
var m1 = new models.anonymous({title: 'Test'});
m1.should.have.property('title', 'Test');
m1.should.have.property('author', 'Raymond');
models = loadSchemasSync(path.join(__dirname, 'test2-schemas.json'));
models.should.have.property('address');