What do we want?
Something similar to (roughly, not even syntactically ok):
------
class User {
@Min(10)
@Max(10)
@NotNull
private _name: string
}
------ or
class User {
private _name: string
@Min(10)
@Max(10)
@NotNull
set name (): string {
}
}
validator = new JoiValidator(...) // <- this is what we want.
user:User = new User(...)
errors:Error = validator.validate(user)
for (let error:Error of errors) {
console.log(error)
}
I can see a problem with it... we are then tied to Joi which it is fine because it is a de-facto standard but we need to compromise on it.