Skip to content

Commit

Permalink
docs: Document the Validator interface
Browse files Browse the repository at this point in the history
resolves #2
  • Loading branch information
romshark committed Jan 3, 2025
1 parent a0f8875 commit e1380d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions yamagiconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ func Validate[T any](t T) error {
return invokeValidateRecursively(typeName, reflect.ValueOf(t), nil)
}

// Validator defines the interface yamagiconf supports for custom validation code.
// Any implementation of this interface will be found (recursively) and the Validate
// method will be invoked.
type Validator interface{ Validate() error }

// asIface[I any] returns nil if v doesn't implement the Validator interface
Expand Down

0 comments on commit e1380d1

Please sign in to comment.