Currently validation logic is done from Validator object. We can make models self-validate themselves.
Below is schema of Validator:
type Validator struct {
db *db.DB
sanitizer markup.Sanitizer
resolver *idresolver.Resolver
enforcer *rbac.Enforcer
}
- we don't need db validation because in atproto, the target object might not be ingested yet.
- we do need to perform sanitizing check, but we can make singleton for these instead. (we are using just
markup.NewSanitizer()) - we don't need did validation because of similar reason. syntax level check is enough.
- we do need to perform rbac check, but we are already doing it in most places without using centralized
Validatorobject.
Therefore, I think we don't need a struct to group validation dependencies.
Let's ditch most of the dependencies needed to validate the model and just call Issue.Validate() instead.
+1 from me. Makes sense.