diff --git a/lib/model-builder.js b/lib/model-builder.js index 7cceeb10..b2455cbb 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -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; diff --git a/test/adl.test.js b/test/adl.test.js index 546bbf1a..5034f945 100644 --- a/test/adl.test.js +++ b/test/adl.test.js @@ -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');