dchambers / composerjs

The composable modelling library
1 stars 1 forks source link

Default values for properties #29

Closed james-shaw-turner closed 9 years ago

james-shaw-turner commented 9 years ago

@dchambers We will want to allow handlers to define default values for fields, which can then be (possibly) overridden when the model is built. For example consider an AmountHandler in an FX-Tile. It would perform (at least) some numeric and range check validation. It would therefore want to set the default value of the "amount" property to 0. In a particular implementation of an FX-Tile you might want a default of 10,000. This can be easily accommodated by adding to the property specifier

{ path: 'prop1', as: 'x', defaultValue: 0 }

dchambers commented 9 years ago

I've spoken to @james-shaw-turner and explained that this isn't needed as handlers effectively provide the 'default' value the first time they are invoked.