line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Maximum; |
2
|
|
|
|
|
|
|
|
3
|
44
|
|
|
44
|
|
28924
|
use strict; |
|
44
|
|
|
|
|
93
|
|
|
44
|
|
|
|
|
1093
|
|
4
|
44
|
|
|
44
|
|
209
|
use warnings; |
|
44
|
|
|
|
|
87
|
|
|
44
|
|
|
|
|
1169
|
|
5
|
44
|
|
|
44
|
|
197
|
use parent qw(JSV::Keyword); |
|
44
|
|
|
|
|
94
|
|
|
44
|
|
|
|
|
223
|
|
6
|
44
|
|
|
44
|
|
1909
|
use JSON; |
|
44
|
|
|
|
|
91
|
|
|
44
|
|
|
|
|
322
|
|
7
|
|
|
|
|
|
|
|
8
|
44
|
|
|
44
|
|
4578
|
use JSV::Keyword qw(:constants); |
|
44
|
|
|
|
|
85
|
|
|
44
|
|
|
|
|
10419
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub instance_type() { INSTANCE_TYPE_NUMERIC(); } |
11
|
|
|
|
|
|
|
sub keyword() { "maximum" } |
12
|
|
|
|
|
|
|
sub keyword_priority() { 10; } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub validate { |
15
|
39
|
|
|
39
|
0
|
66
|
my ($class, $context, $schema, $instance) = @_; |
16
|
|
|
|
|
|
|
|
17
|
39
|
|
|
|
|
132
|
my $maximum = $class->keyword_value($schema); |
18
|
39
|
|
66
|
|
|
115
|
my $exclusive_maximum = $class->keyword_value($schema, "exclusiveMaximum") || JSON::false; |
19
|
|
|
|
|
|
|
|
20
|
39
|
100
|
|
|
|
364
|
if ($exclusive_maximum) { |
21
|
23
|
100
|
|
|
|
166
|
if ($instance >= $maximum) { |
22
|
11
|
|
|
|
|
32
|
$context->log_error("The instance value is greater than or equals maximum keyword value"); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
16
|
100
|
|
|
|
137
|
if ($instance > $maximum) { |
27
|
7
|
|
|
|
|
39
|
$context->log_error("The instance value is greater than maximum keyword value"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |