line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Maximum; |
2
|
|
|
|
|
|
|
|
3
|
47
|
|
|
47
|
|
21365
|
use strict; |
|
47
|
|
|
|
|
57
|
|
|
47
|
|
|
|
|
1145
|
|
4
|
47
|
|
|
47
|
|
147
|
use warnings; |
|
47
|
|
|
|
|
52
|
|
|
47
|
|
|
|
|
1004
|
|
5
|
47
|
|
|
47
|
|
139
|
use parent qw(JSV::Keyword); |
|
47
|
|
|
|
|
58
|
|
|
47
|
|
|
|
|
188
|
|
6
|
47
|
|
|
47
|
|
1894
|
use JSON; |
|
47
|
|
|
|
|
51
|
|
|
47
|
|
|
|
|
211
|
|
7
|
|
|
|
|
|
|
|
8
|
47
|
|
|
47
|
|
3873
|
use JSV::Keyword qw(:constants); |
|
47
|
|
|
|
|
51
|
|
|
47
|
|
|
|
|
8819
|
|
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
|
46
|
my ($class, $context, $schema, $instance) = @_; |
16
|
|
|
|
|
|
|
|
17
|
39
|
|
|
|
|
106
|
my $maximum = $class->keyword_value($schema); |
18
|
39
|
|
66
|
|
|
73
|
my $exclusive_maximum = $class->keyword_value($schema, "exclusiveMaximum") || JSON::false; |
19
|
|
|
|
|
|
|
|
20
|
39
|
100
|
|
|
|
273
|
if ($exclusive_maximum) { |
21
|
23
|
100
|
|
|
|
122
|
if ($instance >= $maximum) { |
22
|
11
|
|
|
|
|
23
|
$context->log_error("The instance value is greater than or equals maximum keyword value"); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
16
|
100
|
|
|
|
102
|
if ($instance > $maximum) { |
27
|
7
|
|
|
|
|
38
|
$context->log_error("The instance value is greater than maximum keyword value"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |