Update model classes, Generalize form creation for CRUD operations on general models
Should be pretty easy to implement generic form generation for CRUD entities, given certain information maintained in the model:
- Model should contain
Model.prototype.schema
that defines the expected fields on the model. It should be possible to also note fields as other classes... May need to create some intermediary types for this (Model.listOf(...)
,Model.Number
,Model.Text
,Model.LongerText
) - Model should define a
validate()
method that when called produces a list of ways the model fails validation - Model should define
serialize()
method that
Having these things in place will enable creation of a component like <entity-form>
that can take in just the model class, and automatically build itself based on the contents of ModelClass.prototype.schema
Edited by MrMan