onehilltech / blueprint

solid framework for building APIs and backend services
125 stars 26 forks source link

Direct support for validation schemas #27

Closed hilljh82 closed 8 years ago

hilljh82 commented 8 years ago

The validation property on the object returned from a controller method is assumed to be a function. There are times when the validation is to only use a schema from express-validator. Unfortunately, to do some requires writing the same one-liner function. It would be nice to either provide a validation function or schema to the validate property. Something like this:

MyController.prototype.someMethod = function () {
  return {
    validate: {
      // add validation schema here
    }
}