line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::AnyOf; |
2
|
2
|
|
|
2
|
|
867
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
49
|
|
3
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
39
|
|
4
|
2
|
|
|
2
|
|
6
|
use utf8; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
7
|
|
5
|
2
|
|
|
2
|
|
378
|
use parent qw(Valiemon::Attributes); |
|
2
|
|
|
|
|
234
|
|
|
2
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
86
|
use Carp qw(croak); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
90
|
|
8
|
2
|
|
|
2
|
|
418
|
use List::MoreUtils qw(any); |
|
2
|
|
|
|
|
7437
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
691
|
use Valiemon::Context; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
288
|
|
11
|
|
|
|
|
|
|
|
12
|
13
|
|
|
13
|
0
|
27
|
sub attr_name { 'anyOf' } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub is_valid { |
15
|
15
|
|
|
15
|
0
|
15
|
my ($class, $context, $schema, $data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
15
|
|
|
|
|
16
|
my $anyOf = $schema->{anyOf}; |
18
|
15
|
100
|
66
|
|
|
61
|
if (ref $anyOf ne 'ARRAY' || scalar @$anyOf < 1) { |
19
|
2
|
|
|
|
|
5
|
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
|
|
|
|
|
47
|
my $clone_context = Valiemon::Context->clone_from($context); |
25
|
19
|
|
|
|
|
181
|
$clone_context->sub_validator($_)->validate($data, $clone_context); |
26
|
13
|
|
|
13
|
|
54
|
} @$anyOf; |
27
|
13
|
|
|
|
|
54
|
}); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |