validateData method
Implementation
Future<Map<String, dynamic>> validateData(Map<String, String> rules, [Map<String, String>? messages]) async {
final result = await Validator.validate(body, rules, messages);
if (result.fails) {
throw ValidationException(result.errors);
}
// Merge coerced data back into request body or return as "cleaned" data
// Usually, we return the cleaned data so the controller doesn't use unvalidated input
return result.data;
}