line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::AnyOf; |
2
|
2
|
|
|
2
|
|
1314
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
60
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
4
|
2
|
|
|
2
|
|
10
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
5
|
2
|
|
|
2
|
|
470
|
use parent qw(Valiemon::Attributes); |
|
2
|
|
|
|
|
353
|
|
|
2
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
120
|
use Carp qw(croak); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
103
|
|
8
|
2
|
|
|
2
|
|
550
|
use List::MoreUtils qw(any); |
|
2
|
|
|
|
|
12270
|
|
|
2
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
1746
|
use Valiemon::Context; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
426
|
|
11
|
|
|
|
|
|
|
|
12
|
13
|
|
|
13
|
0
|
41
|
sub attr_name { 'anyOf' } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub is_valid { |
15
|
15
|
|
|
15
|
0
|
33
|
my ($class, $context, $schema, $data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
15
|
|
|
|
|
31
|
my $anyOf = $schema->{anyOf}; |
18
|
15
|
100
|
66
|
|
|
96
|
if (ref $anyOf ne 'ARRAY' || scalar @$anyOf < 1) { |
19
|
2
|
|
|
|
|
7
|
croak sprintf '`anyOf` must be an array and have at least one element at %s', $context->position |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
23
|
|
|
|
|
|
|
any { |
24
|
19
|
|
|
|
|
62
|
my $clone_context = Valiemon::Context->clone_from($context); |
25
|
19
|
|
|
|
|
276
|
$clone_context->sub_validator($_)->validate($data, $clone_context); |
26
|
13
|
|
|
13
|
|
114
|
} @$anyOf; |
27
|
13
|
|
|
|
|
77
|
}); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |