line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSONSchema::Validator::Constraints::Draft7; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: JSON Schema Draft7 specification constraints |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
44
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
181
|
|
6
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
229
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
38
|
use JSONSchema::Validator::JSONPointer 'json_pointer'; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
325
|
|
9
|
6
|
|
|
6
|
|
55
|
use JSONSchema::Validator::Error 'error'; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
387
|
|
10
|
6
|
|
|
6
|
|
43
|
use JSONSchema::Validator::Util qw(is_type serialize unbool); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
337
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
38
|
use parent 'JSONSchema::Validator::Constraints::Draft6'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
51
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub if { |
15
|
8
|
|
|
8
|
0
|
26
|
my ($self, $instance, $if, $schema, $instance_path, $schema_path, $data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
8
|
|
|
|
|
17
|
my $errors = $data->{errors}; |
18
|
8
|
|
|
|
|
22
|
$data->{errors} = []; |
19
|
|
|
|
|
|
|
|
20
|
8
|
|
|
|
|
34
|
my $result = $self->validator->_validate_schema($instance, $if, $instance_path, $schema_path, $data); |
21
|
8
|
|
|
|
|
31
|
$data->{errors} = $errors; |
22
|
8
|
100
|
|
|
|
26
|
if ($result) { |
23
|
4
|
50
|
|
|
|
14
|
return 1 unless exists $schema->{then}; |
24
|
4
|
|
|
|
|
9
|
my $then = $schema->{then}; |
25
|
4
|
|
|
|
|
13
|
my $spath = json_pointer->append($schema_path, 'then'); |
26
|
4
|
|
|
|
|
27
|
return $self->validator->_validate_schema($instance, $then, $instance_path, $spath, $data); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
4
|
50
|
|
|
|
15
|
return 1 unless exists $schema->{else}; |
30
|
4
|
|
|
|
|
10
|
my $else = $schema->{else}; |
31
|
4
|
|
|
|
|
13
|
my $spath = json_pointer->append($schema_path, 'else'); |
32
|
4
|
|
|
|
|
21
|
return $self->validator->_validate_schema($instance, $else, $instance_path, $spath, $data); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |