line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Format; |
2
|
|
|
|
|
|
|
|
3
|
44
|
|
|
44
|
|
45135
|
use strict; |
|
44
|
|
|
|
|
95
|
|
|
44
|
|
|
|
|
1080
|
|
4
|
44
|
|
|
44
|
|
218
|
use warnings; |
|
44
|
|
|
|
|
92
|
|
|
44
|
|
|
|
|
1274
|
|
5
|
44
|
|
|
44
|
|
218
|
use parent qw(JSV::Keyword); |
|
44
|
|
|
|
|
87
|
|
|
44
|
|
|
|
|
320
|
|
6
|
|
|
|
|
|
|
|
7
|
44
|
|
|
44
|
|
2297
|
use JSV::Keyword qw(:constants); |
|
44
|
|
|
|
|
84
|
|
|
44
|
|
|
|
|
12270
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub instance_type() { INSTANCE_TYPE_STRING(); } |
10
|
|
|
|
|
|
|
sub keyword() { "format" } |
11
|
|
|
|
|
|
|
sub keyword_priority() { 10; } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub validate { |
14
|
10
|
|
|
10
|
0
|
18
|
my ($class, $context, $schema, $instance) = @_; |
15
|
10
|
50
|
|
|
|
28
|
return unless $context->enable_format; |
16
|
|
|
|
|
|
|
|
17
|
10
|
|
|
|
|
73
|
my $format = $class->keyword_value($schema); |
18
|
|
|
|
|
|
|
|
19
|
10
|
50
|
|
|
|
29
|
if ( my $format_validator = $context->formats->{$format} ) { |
20
|
10
|
100
|
|
|
|
68
|
unless ( $format_validator->($instance) ) { |
21
|
8
|
|
|
|
|
35
|
$context->log_error("The instance does not pass '$format' format check"); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |