ufront / ufront-mvc

The core MVC framework that powers ufront
MIT License
17 stars 15 forks source link

Custom parser for controller parameters #59

Open kevinresol opened 8 years ago

kevinresol commented 8 years ago

Currently the controller supports Bool, Int,Float,String,Date and their arrays as route parameters. They are parsed from html string to haxe values internally in ControllerMacros. It would be nice if users can provide their own parsers.

For example, currently ControllerMacros uses Date.fromString to parse a date. But if custom parsers are allowed I can parse, for example, "now" as Date.now()

Related: #48

francescoagati commented 8 years ago

mcli (https://github.com/waneck/mcli) and mweb (https://github.com/waneck/mweb) have supports for this feature with decoder using also abstracts. you can see an example here https://github.com/francescoagati/mweb-subdspatch-test/blob/master/Main.hx#L44