line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Keyword::Draft4::Required; |
2
|
|
|
|
|
|
|
|
3
|
47
|
|
|
47
|
|
37333
|
use strict; |
|
47
|
|
|
|
|
104
|
|
|
47
|
|
|
|
|
1265
|
|
4
|
47
|
|
|
47
|
|
251
|
use warnings; |
|
47
|
|
|
|
|
95
|
|
|
47
|
|
|
|
|
1347
|
|
5
|
47
|
|
|
47
|
|
231
|
use parent qw(JSV::Keyword); |
|
47
|
|
|
|
|
89
|
|
|
47
|
|
|
|
|
272
|
|
6
|
|
|
|
|
|
|
|
7
|
47
|
|
|
47
|
|
2714
|
use JSV::Keyword qw(:constants); |
|
47
|
|
|
|
|
112
|
|
|
47
|
|
|
|
|
13969
|
|
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
|
217
|
my ($class, $context, $schema, $instance) = @_; |
15
|
|
|
|
|
|
|
|
16
|
106
|
|
|
|
|
364
|
my $keyword_value = $class->keyword_value($schema); |
17
|
|
|
|
|
|
|
|
18
|
106
|
|
|
|
|
213
|
my @missing_properties = ( grep { !exists $instance->{$_} } @$keyword_value ); |
|
126
|
|
|
|
|
422
|
|
19
|
106
|
100
|
|
|
|
399
|
if ( @missing_properties != 0 ) { |
20
|
25
|
|
|
|
|
181
|
$context->log_error(sprintf("The instance properties has not required properties (missing: %s)", join(", ", @missing_properties))); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |