dry-python/classes

Refactor validators

sobolevn opened this issue · 0 comments

Right now validators are very complicated.
They do a lot of stuff:

  • Type inference
  • Conditional logic
  • etc

Most of the problematic validators return Tuple or Context types.

Validators must do just one thing: validation.
Other steps should be executed on a higher level.

.instance call steps should be:

  1. We infer everything we need: runtime_type, instance_type, etc
  2. We register things we need with mro.metadata
  3. Then we validate everything we need
  4. Error handling / etc