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)
}
Oh, that is a good idea... I've been too long in Java. On that way we support out of the box all the joi constraints and we dont need to make changes if there are new.