line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MinProperties; |
2
|
1
|
|
|
1
|
|
442
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
17
|
use parent qw(Valiemon::Attributes); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
40
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
154
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
0
|
6
|
sub attr_name { 'minProperties' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
4
|
|
|
4
|
0
|
5
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
4
|
100
|
|
|
|
10
|
return 1 unless ref $data eq 'HASH'; # ignore |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
|
|
4
|
my $min_properties = $schema->{minProperties}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
3
|
50
|
33
|
3
|
|
5
|
if (!$context->prims->is_integer($min_properties) || !(0 <= $min_properties)) { |
19
|
0
|
|
|
|
|
0
|
croak sprintf '`minProperties` must be an integer. This integer must be greater than, or equal to 0 at %s', |
20
|
|
|
|
|
|
|
$context->position; |
21
|
|
|
|
|
|
|
} |
22
|
3
|
|
|
|
|
10
|
scalar keys %$data >= $min_properties; |
23
|
3
|
|
|
|
|
12
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |