2 Commits

Author SHA1 Message Date
9c3b63361d fix(validate): do not panic with field errors on non-struct types
When validating non-struct types, we should not try and convert field
values in errors, because there is no struct field to lookup. Hence this
fix stops a panic from happening.

It is up to the Validate() method itself to provide the correct and
final field value when validating non-struct types.
2021-08-23 12:55:24 +01:00
464467ec86 feat(validate): initial implementation
This is a bare-bones implementation of a basic validation package based
around a very simply Validatable interface:

    type Validatable interface {
        Validate() error
    }

The goal is to keep things as simple as possible, while also giving as
much control as possible over how validation logic is performed.
2021-08-22 21:53:02 +01:00