Merge pull request #317 from nasa/open316

[bug] TypeImpl.getInitialmodel should always return a fresh (ie. cloned) model.
This commit is contained in:
Victor Woeltjen
2015-11-18 12:21:23 -08:00
2 changed files with 14 additions and 1 deletions

View File

@ -156,8 +156,15 @@ define(
});
};
/**
* Returns the default model for an object of this type. Note that
* this method returns a clone of the original model, so if using this
* method heavily, consider caching the result to optimize performance.
*
* @return {object} The default model for an object of this type.
*/
TypeImpl.prototype.getInitialModel = function () {
return this.typeDef.model || {};
return JSON.parse(JSON.stringify(this.typeDef.model || {}));
};
TypeImpl.prototype.getDefinition = function () {