validate method
Validate data against the schema. Returns a map of field keys to error messages (empty if valid).
Implementation
Map<String, String> validate(Map<String, dynamic> data) {
final errors = <String, String>{};
final parser = JsonSchemaParser();
final properties = parser.parse(schema);
for (final prop in properties) {
final value = data[prop.key];
final error = _validateValue(prop, value);
if (error != null) {
errors[prop.key] = error;
}
}
return errors;
}