line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Format; |
2
|
|
|
|
|
|
|
|
3
|
47
|
|
|
47
|
|
42319
|
use strict; |
|
47
|
|
|
|
|
115
|
|
|
47
|
|
|
|
|
1300
|
|
4
|
47
|
|
|
47
|
|
267
|
use warnings; |
|
47
|
|
|
|
|
108
|
|
|
47
|
|
|
|
|
1507
|
|
5
|
47
|
|
|
47
|
|
247
|
use parent qw(JSV::Keyword); |
|
47
|
|
|
|
|
99
|
|
|
47
|
|
|
|
|
407
|
|
6
|
|
|
|
|
|
|
|
7
|
47
|
|
|
47
|
|
2944
|
use JSV::Keyword qw(:constants); |
|
47
|
|
|
|
|
105
|
|
|
47
|
|
|
|
|
15072
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub instance_type() { INSTANCE_TYPE_STRING(); } |
10
|
|
|
|
|
|
|
sub keyword() { "format" } |
11
|
|
|
|
|
|
|
sub keyword_priority() { 10; } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub validate { |
14
|
48
|
|
|
48
|
0
|
112
|
my ($class, $context, $schema, $instance) = @_; |
15
|
48
|
50
|
|
|
|
151
|
return unless $context->enable_format; |
16
|
|
|
|
|
|
|
|
17
|
48
|
|
|
|
|
393
|
my $format = $class->keyword_value($schema); |
18
|
|
|
|
|
|
|
|
19
|
48
|
50
|
|
|
|
165
|
if ( my $format_validator = $context->formats->{$format} ) { |
20
|
48
|
100
|
|
|
|
408
|
unless ( $format_validator->($instance) ) { |
21
|
34
|
|
|
|
|
717
|
$context->log_error("The instance does not pass '$format' format check"); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |