line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Format; |
2
|
|
|
|
|
|
|
|
3
|
47
|
|
|
47
|
|
23843
|
use strict; |
|
47
|
|
|
|
|
68
|
|
|
47
|
|
|
|
|
1193
|
|
4
|
47
|
|
|
47
|
|
144
|
use warnings; |
|
47
|
|
|
|
|
52
|
|
|
47
|
|
|
|
|
1038
|
|
5
|
47
|
|
|
47
|
|
139
|
use parent qw(JSV::Keyword); |
|
47
|
|
|
|
|
54
|
|
|
47
|
|
|
|
|
209
|
|
6
|
|
|
|
|
|
|
|
7
|
47
|
|
|
47
|
|
2217
|
use JSV::Keyword qw(:constants); |
|
47
|
|
|
|
|
58
|
|
|
47
|
|
|
|
|
9472
|
|
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
|
47
|
my ($class, $context, $schema, $instance) = @_; |
15
|
48
|
50
|
|
|
|
70
|
return unless $context->enable_format; |
16
|
|
|
|
|
|
|
|
17
|
48
|
|
|
|
|
204
|
my $format = $class->keyword_value($schema); |
18
|
|
|
|
|
|
|
|
19
|
48
|
50
|
|
|
|
66
|
if ( my $format_validator = $context->formats->{$format} ) { |
20
|
48
|
100
|
|
|
|
224
|
unless ( $format_validator->($instance) ) { |
21
|
34
|
|
|
|
|
452
|
$context->log_error("The instance does not pass '$format' format check"); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |