edjafarov/aries

Create annotation validationas handlers

Opened this issue · 0 comments

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?