Add options including default
This commit is contained in:
parent
2a15926318
commit
771bf70ec5
|
@ -416,7 +416,14 @@ function buildSchema(name, properties, associations) {
|
||||||
});
|
});
|
||||||
delete properties[p];
|
delete properties[p];
|
||||||
} else {
|
} 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;
|
return properties;
|
||||||
|
|
|
@ -179,6 +179,7 @@ describe('Load models from json', function () {
|
||||||
|
|
||||||
var m1 = new models.anonymous({title: 'Test'});
|
var m1 = new models.anonymous({title: 'Test'});
|
||||||
m1.should.have.property('title', 'Test');
|
m1.should.have.property('title', 'Test');
|
||||||
|
m1.should.have.property('author', 'Raymond');
|
||||||
|
|
||||||
models = loadSchemasSync(path.join(__dirname, 'test2-schemas.json'));
|
models = loadSchemasSync(path.join(__dirname, 'test2-schemas.json'));
|
||||||
models.should.have.property('address');
|
models.should.have.property('address');
|
||||||
|
|
Loading…
Reference in New Issue