line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Required; |
2
|
|
|
|
|
|
|
|
3
|
47
|
|
|
47
|
|
22026
|
use strict; |
|
47
|
|
|
|
|
61
|
|
|
47
|
|
|
|
|
1111
|
|
4
|
47
|
|
|
47
|
|
129
|
use warnings; |
|
47
|
|
|
|
|
46
|
|
|
47
|
|
|
|
|
964
|
|
5
|
47
|
|
|
47
|
|
141
|
use parent qw(JSV::Keyword); |
|
47
|
|
|
|
|
46
|
|
|
47
|
|
|
|
|
180
|
|
6
|
|
|
|
|
|
|
|
7
|
47
|
|
|
47
|
|
1947
|
use JSV::Keyword qw(:constants); |
|
47
|
|
|
|
|
51
|
|
|
47
|
|
|
|
|
9577
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub instance_type() { INSTANCE_TYPE_OBJECT(); } |
10
|
|
|
|
|
|
|
sub keyword() { "required" } |
11
|
|
|
|
|
|
|
sub keyword_priority() { 10; } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub validate { |
14
|
106
|
|
|
106
|
0
|
97
|
my ($class, $context, $schema, $instance) = @_; |
15
|
|
|
|
|
|
|
|
16
|
106
|
|
|
|
|
165
|
my $keyword_value = $class->keyword_value($schema); |
17
|
|
|
|
|
|
|
|
18
|
106
|
|
|
|
|
110
|
my @missing_properties = ( grep { !exists $instance->{$_} } @$keyword_value ); |
|
126
|
|
|
|
|
216
|
|
19
|
106
|
100
|
|
|
|
226
|
if ( @missing_properties != 0 ) { |
20
|
25
|
|
|
|
|
122
|
$context->log_error(sprintf("The instance properties has not required properties (missing: %s)", join(", ", @missing_properties))); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |