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
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
165
|
|
6
|
6
|
|
|
6
|
|
29
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
151
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
29
|
use JSONSchema::Validator::JSONPointer 'json_pointer'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
283
|
|
9
|
6
|
|
|
6
|
|
50
|
use JSONSchema::Validator::Error 'error'; |
|
6
|
|
|
|
|
26
|
|
|
6
|
|
|
|
|
329
|
|
10
|
6
|
|
|
6
|
|
42
|
use JSONSchema::Validator::Util qw(is_type serialize unbool); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
349
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
47
|
use parent 'JSONSchema::Validator::Constraints::Draft6'; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
52
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub if { |
15
|
8
|
|
|
8
|
0
|
24
|
my ($self, $instance, $if, $schema, $instance_path, $schema_path, $data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
8
|
|
|
|
|
17
|
my $errors = $data->{errors}; |
18
|
8
|
|
|
|
|
19
|
$data->{errors} = []; |
19
|
|
|
|
|
|
|
|
20
|
8
|
|
|
|
|
29
|
my $result = $self->validator->_validate_schema($instance, $if, $instance_path, $schema_path, $data); |
21
|
8
|
|
|
|
|
25
|
$data->{errors} = $errors; |
22
|
8
|
100
|
|
|
|
25
|
if ($result) { |
23
|
4
|
50
|
|
|
|
14
|
return 1 unless exists $schema->{then}; |
24
|
4
|
|
|
|
|
9
|
my $then = $schema->{then}; |
25
|
4
|
|
|
|
|
16
|
my $spath = json_pointer->append($schema_path, 'then'); |
26
|
4
|
|
|
|
|
13
|
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
|
|
|
|
|
11
|
my $else = $schema->{else}; |
31
|
4
|
|
|
|
|
14
|
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__ |