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
|
|
40
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
145
|
|
6
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
154
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
30
|
use JSONSchema::Validator::JSONPointer 'json_pointer'; |
|
6
|
|
|
|
|
47
|
|
|
6
|
|
|
|
|
276
|
|
9
|
6
|
|
|
6
|
|
42
|
use JSONSchema::Validator::Error 'error'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
312
|
|
10
|
6
|
|
|
6
|
|
56
|
use JSONSchema::Validator::Util qw(is_type serialize unbool); |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
304
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
31
|
use parent 'JSONSchema::Validator::Constraints::Draft6'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
29
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub if { |
15
|
8
|
|
|
8
|
0
|
23
|
my ($self, $instance, $if, $schema, $instance_path, $schema_path, $data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
8
|
|
|
|
|
15
|
my $errors = $data->{errors}; |
18
|
8
|
|
|
|
|
16
|
$data->{errors} = []; |
19
|
|
|
|
|
|
|
|
20
|
8
|
|
|
|
|
24
|
my $result = $self->validator->_validate_schema($instance, $if, $instance_path, $schema_path, $data); |
21
|
8
|
|
|
|
|
30
|
$data->{errors} = $errors; |
22
|
8
|
100
|
|
|
|
18
|
if ($result) { |
23
|
4
|
50
|
|
|
|
33
|
return 1 unless exists $schema->{then}; |
24
|
4
|
|
|
|
|
10
|
my $then = $schema->{then}; |
25
|
4
|
|
|
|
|
14
|
my $spath = json_pointer->append($schema_path, 'then'); |
26
|
4
|
|
|
|
|
24
|
return $self->validator->_validate_schema($instance, $then, $instance_path, $spath, $data); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
4
|
50
|
|
|
|
23
|
return 1 unless exists $schema->{else}; |
30
|
4
|
|
|
|
|
19
|
my $else = $schema->{else}; |
31
|
4
|
|
|
|
|
13
|
my $spath = json_pointer->append($schema_path, 'else'); |
32
|
4
|
|
|
|
|
15
|
return $self->validator->_validate_schema($instance, $else, $instance_path, $spath, $data); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |