edjafarov / aries

AriesNode is a MVC framework for node.
aries.no.de
10 stars 0 forks source link

Create annotation validationas handlers #21

Open edjafarov opened 13 years ago

edjafarov commented 13 years ago

For any attribute in controller we should be able to put annotation that defines how this attribute should be validated. for example:

function exampleController(request, response, /** @validate(NotNull, IsNumber) */someAttribute){

}

Also it should be possible to create custom validators:

function exampleController(request, response, /** @validate(RigtDateFormat) */someAttribute){

}

The creation of such custom validators will be fairly simple:

/**
* @AssignValidator( id="RightDateFormat")
*/
function RightDateValidator(param){
          /*  some validation function, probably asyncronous */
          this.doNext(true/false);
}

Only question opened is how to handle errors?