ModelBuilder: add `prototype.defineValueType`
Add a shortcut for registering a new value type. The current implementation registers the type in the singleton registry `ModelBuilder.schemaTypes`. The API should allow us to to change the implementation to register the type in the scope of ModelBuilder instance only.
This commit is contained in:
parent
a86648ed7b
commit
d8b4f5833a
|
@ -432,6 +432,15 @@ ModelBuilder.prototype.defineProperty = function (model, propertyName, propertyD
|
|||
this.models[model].registerProperty(propertyName);
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a new value type that can be used in model schemas as a property type.
|
||||
* @param {function()} type Type constructor.
|
||||
* @param {string[]=} aliases Optional list of alternative names for this type.
|
||||
*/
|
||||
ModelBuilder.prototype.defineValueType = function(type, aliases) {
|
||||
ModelBuilder.registerType(type, aliases);
|
||||
};
|
||||
|
||||
/**
|
||||
* Extend existing model with bunch of properties
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue