getErrors method
Get validation errors
Implementation
@override
List<String> getErrors(Map<String, dynamic>? value) {
final errors = <String>[];
if (value == null) {
if (required) errors.add('Object is required');
return errors;
}
for (final entry in properties.entries) {
final propValue = value[entry.key];
final propErrors = entry.value.getErrors(propValue);
for (final error in propErrors) {
errors.add('${entry.key}: $error');
}
}
if (!additionalProperties) {
for (final key in value.keys) {
if (!properties.containsKey(key)) {
errors.add('Unknown property: $key');
}
}
}
return errors;
}