When a schema allows a set of types, and 'null' is one of the possible types, if an data type is provided that is not in the set of types permitted by the schema, the error message returned is simply 'Not Null.' whereas in previous versions this would report which types are allowed.
See the script below for a simple example.
#!/usr/bin/perl
use strict;
use warnings;
use JSON::Validator();
my $jsv = JSON::Validator->new();
$jsv->schema({
type => 'object',
properties => {
price => {
type => [
'number',
'null'
]
}
}
});
my @errors = $jsv->validate({ price => '10.11' });
foreach my $error (@errors) {
print $error->message;
print "\n";
}
Expected behavior
Should get message: 'Expected number/null - got string.'
Steps to reproduce the behavior
When a schema allows a set of types, and 'null' is one of the possible types, if an data type is provided that is not in the set of types permitted by the schema, the error message returned is simply 'Not Null.' whereas in previous versions this would report which types are allowed.
See the script below for a simple example.
Expected behavior
Should get message: 'Expected number/null - got string.'
Actual behavior
Get message: 'Not null.'