line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MinProperties; |
2
|
1
|
|
|
1
|
|
604
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
25
|
use parent qw(Valiemon::Attributes); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
57
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
204
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
0
|
10
|
sub attr_name { 'minProperties' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
4
|
|
|
4
|
0
|
11
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
4
|
100
|
|
|
|
14
|
return 1 unless ref $data eq 'HASH'; # ignore |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
|
|
5
|
my $min_properties = $schema->{minProperties}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
3
|
50
|
33
|
3
|
|
9
|
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
|
|
|
|
|
15
|
scalar keys %$data >= $min_properties; |
23
|
3
|
|
|
|
|
18
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |