line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Required; |
2
|
|
|
|
|
|
|
|
3
|
44
|
|
|
44
|
|
30302
|
use strict; |
|
44
|
|
|
|
|
91
|
|
|
44
|
|
|
|
|
1029
|
|
4
|
44
|
|
|
44
|
|
200
|
use warnings; |
|
44
|
|
|
|
|
74
|
|
|
44
|
|
|
|
|
1036
|
|
5
|
44
|
|
|
44
|
|
193
|
use parent qw(JSV::Keyword); |
|
44
|
|
|
|
|
70
|
|
|
44
|
|
|
|
|
216
|
|
6
|
|
|
|
|
|
|
|
7
|
44
|
|
|
44
|
|
2060
|
use JSV::Keyword qw(:constants); |
|
44
|
|
|
|
|
91
|
|
|
44
|
|
|
|
|
11560
|
|
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
|
167
|
my ($class, $context, $schema, $instance) = @_; |
15
|
|
|
|
|
|
|
|
16
|
106
|
|
|
|
|
283
|
my $keyword_value = $class->keyword_value($schema); |
17
|
|
|
|
|
|
|
|
18
|
106
|
|
|
|
|
191
|
my @missing_properties = ( grep { !exists $instance->{$_} } @$keyword_value ); |
|
126
|
|
|
|
|
359
|
|
19
|
106
|
100
|
|
|
|
360
|
if ( @missing_properties != 0 ) { |
20
|
25
|
|
|
|
|
156
|
$context->log_error(sprintf("The instance properties has not required properties (missing: %s)", join(", ", @missing_properties))); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |