Skip to content

boolen coercion doesn't work well with perl v5.40 and above #285

@akarelas

Description

@akarelas

Here's a script that claims a valid object is invalid. As you can see, I'm using perl's native booleans:

use v5.42;
use JSON::Validator;

my $jv = JSON::Validator->new;
$jv->coerce('booleans');
$jv->schema({
    type => 'object',
    properties => {
        v => {
            type  => 'boolean',
            const => true,
        }
    }
});
my @errors = $jv->validate({ v => 1 });
say foreach @errors;
say 'ALL OK' if ! @errors;

Same thing happens if I replace const => true with enum => [true].

Also true doesn't validate against const => true, when booleans are coerced.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions