JSONSchema::check_object_warn

A version of check_object that warns and returns true or
false.
This commit is contained in:
Wolfgang Bumiller 2015-09-21 12:11:07 +02:00 committed by Dietmar Maurer
parent d5d10f8580
commit 86425a09da

View File

@ -563,6 +563,19 @@ sub check_object {
}
}
sub check_object_warn {
my ($path, $schema, $value, $additional_properties) = @_;
my $errors = {};
check_object($path, $schema, $value, $additional_properties, $errors);
if (scalar(%$errors)) {
foreach my $k (keys %$errors) {
warn "parse error: $k: $errors->{$k}\n";
}
return 0;
}
return 1;
}
sub check_prop {
my ($value, $schema, $path, $errors) = @_;