validate method
Performs type coercion against an input
value, and returns a
list of errors if the validation was unsuccessful.
Implementation
@override
ValidationResult<Object?> validate(String key, Object? input) {
final result = Json.fromJsonChecked(input, isRoot: true, getter: key);
if (result.isOk()) {
return ValidationResult.ok(input);
}
return ValidationResult.failure(
['Expected "$key" to be an Json. ${result.unwrapErr()}']);
}