line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Maximum; |
2
|
|
|
|
|
|
|
|
3
|
47
|
|
|
47
|
|
35869
|
use strict; |
|
47
|
|
|
|
|
99
|
|
|
47
|
|
|
|
|
1289
|
|
4
|
47
|
|
|
47
|
|
250
|
use warnings; |
|
47
|
|
|
|
|
113
|
|
|
47
|
|
|
|
|
1312
|
|
5
|
47
|
|
|
47
|
|
243
|
use parent qw(JSV::Keyword); |
|
47
|
|
|
|
|
101
|
|
|
47
|
|
|
|
|
336
|
|
6
|
47
|
|
|
47
|
|
2423
|
use JSON; |
|
47
|
|
|
|
|
101
|
|
|
47
|
|
|
|
|
384
|
|
7
|
|
|
|
|
|
|
|
8
|
47
|
|
|
47
|
|
5701
|
use JSV::Keyword qw(:constants); |
|
47
|
|
|
|
|
134
|
|
|
47
|
|
|
|
|
12875
|
|
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
|
86
|
my ($class, $context, $schema, $instance) = @_; |
16
|
|
|
|
|
|
|
|
17
|
39
|
|
|
|
|
174
|
my $maximum = $class->keyword_value($schema); |
18
|
39
|
|
66
|
|
|
138
|
my $exclusive_maximum = $class->keyword_value($schema, "exclusiveMaximum") || JSON::false; |
19
|
|
|
|
|
|
|
|
20
|
39
|
100
|
|
|
|
487
|
if ($exclusive_maximum) { |
21
|
23
|
100
|
|
|
|
215
|
if ($instance >= $maximum) { |
22
|
11
|
|
|
|
|
42
|
$context->log_error("The instance value is greater than or equals maximum keyword value"); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
16
|
100
|
|
|
|
180
|
if ($instance > $maximum) { |
27
|
7
|
|
|
|
|
47
|
$context->log_error("The instance value is greater than maximum keyword value"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |