line |
true |
false |
branch |
61
|
4 |
11 |
$args->{'schema'} ? : |
64
|
3 |
12 |
if ($args->{'replace'}) { } |
69
|
3 |
12 |
if $from_type eq 'HASH' and $tied = tied %$from |
70
|
9 |
6 |
$from_type eq 'HASH' ? : |
|
0 |
15 |
$from_type eq 'ARRAY' ? : |
71
|
9 |
6 |
if $from_type |
81
|
145 |
35 |
unless ($tied) |
82
|
54 |
91 |
$from_type eq 'HASH' ? : |
|
0 |
145 |
$from_type eq 'ARRAY' ? : |
83
|
54 |
91 |
if $from_type |
89
|
8 |
27 |
if not $args->{'schema'} and $tied->fqn =~ /^\Q$self->{'root_schema_url'}\E\#/ |
92
|
27 |
0 |
unless ($self->{'bundled_refs'}{$tied->fqn}++) |
105
|
0 |
15 |
if $args->{'ref_key'} |
111
|
0 |
132 |
if (ref $from eq 'ARRAY') { } |
|
132 |
0 |
elsif (ref $from eq 'HASH') { } |
128
|
5 |
14 |
unless defined(my $what = shift()) |
130
|
1 |
13 |
if ($what eq '1') |
138
|
10 |
4 |
unless ref $what |
148
|
50 |
2 |
unless @_ |
156
|
267 |
3 |
if not $self->{'version'} and $schema =~ /draft-0+(\w+)/ |
159
|
1 |
264 |
if @errors |
167
|
3 |
578 |
if defined $self->{'coerce'} |
173
|
919 |
637 |
unless @_ |
183
|
0 |
930 |
unless defined $schema |
227
|
4 |
23 |
if ($ref->fqn =~ m[#/$prefix/([^/]+)$]) |
230
|
3 |
0 |
if ($self->{'bundled_refs'}{$ref->fqn} or not $node or not $node->{$key} or data_checksum($ref->schema) eq data_checksum($node->{$key})) |
242
|
23 |
0 |
if (-e $spec_path) |
255
|
7814 |
64 |
$_[0]->version < 7 ? : |
260
|
289 |
39 |
if ($url =~ m[^https?://]) |
266
|
18 |
21 |
if ($url =~ m[^data://([^/]*)/(.*)]) |
272
|
0 |
21 |
if ($url =~ /^\s*[\[\{]/) |
281
|
20 |
1 |
if (-e $file) { } |
|
0 |
1 |
elsif ($url =~ m[^/] and $self->ua->server->app) { } |
300
|
327 |
0 |
if $$text =~ /^\s*\{/s |
303
|
0 |
0 |
unless &YAML_SUPPORT() |
319
|
13 |
275 |
unless -r $path |
326
|
2 |
15 |
if $err |
328
|
0 |
11 |
if ($cache_path and $cache_path ne $BUNDLED_CACHE_DIR || $ENV{'JSON_VALIDATOR_CACHE_ANYWAYS'} and -w $cache_path) |
335
|
0 |
0 |
unless $ENV{'HARNESS_ACTIVE'} |
347
|
85 |
54 |
if $create |
348
|
18 |
121 |
unless $node = $$node{$path->[$n]} |
349
|
90 |
31 |
if ++$n + $offset >= @$path |
361
|
0 |
1456 |
if @guard > 100 |
364
|
15 |
1441 |
if is_type($schema, 'BOOL') |
384
|
911 |
6965 |
unless $self->{'level'} |
386
|
586 |
7290 |
if (ref $schema eq 'HASH') { } |
|
6954 |
336 |
elsif ($resolved = $self->{'schemas'}{$schema // ''}) { } |
|
8 |
328 |
elsif (is_type($schema, 'BOOL')) { } |
388
|
0 |
586 |
if $resolved = $self->{'schemas'}{$id} |
399
|
277 |
47 |
if $schema->{$id_key} |
402
|
887 |
23 |
unless ($self->{'level'}) |
404
|
303 |
584 |
if ($rid) |
405
|
1 |
302 |
if $rid =~ /\#./ |
407
|
2 |
11 |
unless $rid =~ /^\w+:/ or -e $rid or $rid =~ m[^/] |
421
|
20 |
887 |
is_type($id, 'Mojo::File') ? : |
425
|
2772 |
37077 |
if (is_type($topic, 'ARRAY')) { } |
|
20585 |
16492 |
elsif (is_type($topic, 'HASH')) { } |
430
|
0 |
20585 |
if $seen{$seen_addr}++ |
433
|
6882 |
13703 |
if $topic->{'$ref'} and not ref $topic->{'$ref'} |
435
|
288 |
13415 |
if ($topic->{$id_key} and not ref $topic->{$id_key}) |
437
|
11 |
277 |
unless $fqn->is_abs |
454
|
129 |
6836 |
if $location_as_url->is_abs |
457
|
22 |
6814 |
if (is_type($base, 'Mojo::File')) |
458
|
7 |
15 |
unless length $location |
467
|
1 |
6881 |
if tied %$topic |
473
|
11 |
13831 |
if is_type($other, 'BOOL') |
476
|
0 |
13831 |
if @guard > 100 |
478
|
6866 |
6965 |
if not $ref or ref $ref |
479
|
0 |
6965 |
$ref =~ m[^/] ? : |
482
|
2472 |
4493 |
if length $location and not length $pointer |
483
|
4493 |
2472 |
if defined $pointer |
487
|
4472 |
21 |
if (defined $pointer and length $pointer and $pointer =~ m[^/]) |
489
|
1 |
4471 |
unless defined $other |
502
|
819 |
4073 |
if ref $schema eq 'HASH' and $schema->{'$ref'} |
503
|
54 |
20 |
$schema ? : |
|
74 |
4883 |
if is_type($schema, 'BOOL') |
506
|
2370 |
2513 |
ref $data ? : |
509
|
293 |
4590 |
if ($self->{'seen'}{$seen_addr}) |
514
|
4 |
4586 |
&blessed($data) && $data->can('TO_JSON') ? : |
516
|
4 |
4586 |
if $to_json |
520
|
97 |
4493 |
if (ref $type eq 'ARRAY') { } |
|
2823 |
1670 |
elsif ($type) { } |
524
|
0 |
97 |
$to_json ? : |
528
|
4 |
2819 |
$to_json ? : |
529
|
541 |
2282 |
if @errors |
532
|
32 |
4017 |
if (exists $schema->{'const'}) |
533
|
0 |
32 |
$to_json ? : |
535
|
12 |
20 |
if @errors |
538
|
505 |
3532 |
if ($schema->{'enum'}) |
539
|
0 |
505 |
$to_json ? : |
541
|
22 |
483 |
if @errors |
544
|
11 |
4004 |
if (my $rules = $schema->{'not'}) |
545
|
0 |
11 |
$to_json ? : |
546
|
5 |
6 |
@errors ? : |
549
|
111 |
3893 |
if (my $rules = $schema->{'allOf'}) |
550
|
0 |
111 |
$to_json ? : |
554
|
569 |
3435 |
if (my $rules = $schema->{'anyOf'}) |
555
|
0 |
569 |
$to_json ? : |
559
|
32 |
3972 |
if (my $rules = $schema->{'oneOf'}) |
560
|
0 |
32 |
$to_json ? : |
564
|
7 |
3997 |
if ($schema->{'if'}) |
568
|
3 |
4 |
$self->_validate($data, $path, $schema->{'if'}) ? : |
582
|
196 |
19 |
unless my(@e) = $self->_validate($_[1], $path, $rule) |
584
|
18 |
1 |
if $schema_type |
585
|
17 |
2 |
if not $schema_type or $schema_type eq $type |
591
|
1 |
110 |
if not @errors and @expected |
593
|
14 |
96 |
if @errors |
605
|
650 |
131 |
unless @e |
607
|
28 |
103 |
if not $schema_type or $schema_type eq $type |
615
|
7 |
9 |
unless @errors |
626
|
30 |
37 |
unless my(@e) = $self->_validate($_[1], $path, $rule) |
628
|
18 |
19 |
if not $schema_type or $schema_type eq $type |
635
|
20 |
12 |
if @passed == 1 |
636
|
3 |
9 |
unless @errors + @expected |
637
|
2 |
7 |
if @passed |
638
|
6 |
1 |
if @errors |
647
|
4 |
376 |
if (is_type($cmp_with, 'BOOL')) { } |
|
2 |
374 |
elsif (is_type($cmp_with, 'NUM')) { } |
650
|
2 |
2 |
unless $value < $schema->{'maximum'} |
653
|
1 |
1 |
unless $value < $cmp_with |
657
|
32 |
348 |
if (exists $schema->{'maximum'}) |
659
|
6 |
26 |
unless $value <= $cmp_with |
671
|
12 |
368 |
if (is_type($cmp_with, 'BOOL')) { } |
|
2 |
366 |
elsif (is_type($cmp_with, 'NUM')) { } |
674
|
2 |
10 |
unless $value > $schema->{'minimum'} |
677
|
1 |
1 |
unless $value > $cmp_with |
681
|
158 |
222 |
if (exists $schema->{'minimum'}) |
683
|
13 |
145 |
unless $value >= $cmp_with |
696
|
502 |
1477 |
if $m eq data_checksum($i) |
700
|
12 |
100 |
!defined($_) || ref $_ ? : |
708
|
31 |
20 |
if data_checksum($data) eq data_checksum($const) |
715
|
1 |
232 |
unless $code |
717
|
195 |
37 |
unless my $err = &$code($value) |
727
|
34 |
237 |
if (ref $data ne 'ARRAY') |
730
|
4 |
233 |
if (defined $schema->{'minItems'} and $schema->{'minItems'} > @$data) |
734
|
4 |
233 |
if (defined $schema->{'maxItems'} and $schema->{'maxItems'} < @$data) |
738
|
93 |
144 |
if ($schema->{'uniqueItems'}) |
741
|
170 |
7 |
unless $uniq{data_checksum($_)}++ |
747
|
2 |
235 |
if ($schema->{'contains'}) { } |
|
17 |
218 |
elsif (ref $schema->{'items'} eq 'ARRAY') { } |
|
159 |
59 |
elsif (exists $schema->{'items'}) { } |
751
|
3 |
1 |
if @tmp |
753
|
1 |
1 |
if @e >= @$data |
759
|
14 |
3 |
if ($additional_items) |
763
|
13 |
4 |
if (@rules == @$data) { } |
|
2 |
2 |
elsif (not $additional_items) { } |
784
|
65 |
81 |
if is_type($value, 'BOOL') |
787
|
27 |
3 |
if (defined $value and $self->{'coerce'}{'booleans'} and B::svref_2object(\$value)->FLAGS & 12288 || $value =~ /^(true|false)$/) |
794
|
24 |
3 |
$value ? : |
805
|
45 |
209 |
if @errors |
806
|
203 |
6 |
if $value =~ /^-?\d+$/ |
813
|
6 |
8 |
unless defined $value |
823
|
17 |
415 |
if (not defined $value or ref $value) |
826
|
85 |
330 |
unless (is_type($value, 'NUM')) |
829
|
35 |
50 |
unless $self->{'coerce'}{'numbers'} and $value =~ /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/ |
834
|
0 |
380 |
if $schema->{'format'} |
839
|
10 |
370 |
if $d and ($value / $d) =~ /\.[^0]+$/ |
848
|
44 |
1356 |
if (ref $data ne 'HASH') |
854
|
2 |
1354 |
if (defined $schema->{'maxProperties'} and $schema->{'maxProperties'} < @dkeys) |
858
|
3 |
1353 |
if (defined $schema->{'minProperties'} and $schema->{'minProperties'} > @dkeys) |
862
|
3 |
1353 |
if (my $n_schema = $schema->{'propertyNames'}) |
864
|
3 |
1 |
unless my(@e) = $self->_validate($name, $path, $n_schema) |
873
|
18 |
30 |
if ($self->{'coerce'}{'defaults'} and ref $r eq 'HASH' and exists $r->{'default'} and not exists $data->{$k}) |
882
|
1319 |
37 |
unless $schema->{'patternProperties'} |
890
|
179 |
1177 |
exists $schema->{'additionalProperties'} ? : |
891
|
1344 |
12 |
if ($additional) { } |
|
6 |
6 |
elsif (my(@k) = grep({not $rules{$_};} @dkeys)) { } |
892
|
1 |
1343 |
unless is_type($additional, 'HASH') |
900
|
1257 |
93 |
unless $schema->{'required'} |
901
|
77 |
27 |
if exists $data->{$k} |
908
|
1530 |
10 |
unless exists $data->{$k} |
909
|
9 |
1 |
if (ref $dependencies->{$k} eq 'ARRAY') { } |
|
1 |
0 |
elsif (ref $dependencies->{$k} eq 'HASH') { } |
922
|
26161 |
2614 |
unless exists $data->{$k} |
923
|
637 |
1948 |
if ref $r eq 'HASH' and $r->{'$ref'} |
926
|
160 |
2454 |
if @e or not is_type($r, 'HASH') |
929
|
19 |
2435 |
if $r->{'enum'} |
932
|
3 |
2451 |
if $r->{'const'} |
943
|
16 |
521 |
if (not defined $value or ref $value) |
946
|
22 |
0 |
if (B::svref_2object(\$value)->FLAGS & 12288 and 0 + $value eq $value and $value * 0 == 0) |
951
|
21 |
1 |
unless $self->{'coerce'}{'strings'} |
954
|
233 |
267 |
if ($schema->{'format'}) |
957
|
38 |
462 |
if (defined $schema->{'maxLength'}) |
958
|
14 |
24 |
if (length $value > $schema->{'maxLength'}) |
963
|
28 |
472 |
if (defined $schema->{'minLength'}) |
964
|
4 |
24 |
if (length $value < $schema->{'minLength'}) |
969
|
35 |
465 |
if (defined $schema->{'pattern'}) |
971
|
14 |
21 |
unless $value =~ /$p/ |