Branch Coverage

blib/lib/JSON/Schema/Modern.pm
Criterion Covered Total %
branch 127 150 84.6


line true false branch
129 0 13700 if @_ < 2
133 0 28 $_[0]->$JSON::Schema::Modern::_isa('Mojo::URL') ? :
13672 28 !XXX ? :
136 1 13699 if defined $uri->fragment
138 2 13697 unless (@_)
140 1 1 unless $schema_info and defined wantarray
145 13683 0 $uri ? :
14 13683 $_[0]->$JSON::Schema::Modern::_isa('JSON::Schema::Modern::Document') ? :
152 117 13580 if ($document->has_errors)
162 13575 5 unless (grep((&refaddr($_->{'document'}) == &refaddr($document)), $self->_canonical_resources))
166 9503 4072 if (my $existing_doc = &first(sub {
180 382 13192 if ("$uri")
196 0 3 unless defined wantarray
293 0 13325 unless defined wantarray
382 0 13208 if $valid xor not @{$state->{'errors'}}
391 18 7356 $config_override->{'collect_annotations'} // $self->collect_annotations ? :
7374 5834 $valid ? :
396 0 3 unless defined wantarray
399 2 1 XXX && $schema->{'$schema'} ? :
406 2 8 unless $schema_info
407 6 2 XXX ? :
408 5 3 wantarray ? :
454 0 32619 if $state->{'depth'}++ > $self->max_traversal_depth
457 6822 25797 if $schema_type eq "boolean"
459 10 25787 if $schema_type ne "object"
461 487 25300 unless keys %$schema
477 1324304 45540 unless exists $schema->{$keyword}
480 26 42955 if $keyword ne "\$ref" and exists $schema->{'$ref'} and $state->{'spec_version'} eq "draft7"
485 179 45335 unless (&$sub($vocabulary, $schema, $state))
486 0 179 unless @{$state->{'errors'}}
491 4 45331 if (my $callback = $state->{'callbacks'}{$keyword})
492 0 4 unless (&$callback($schema, $state))
493 0 0 unless @{$state->{'errors'}}
503 1 25299 if ($self->strict and keys %unknown_keywords)
504 1 0 keys %unknown_keywords > 1 ? :
510 94571 238 unless exists $schema->{$keyword}
513 238 0 if (my $alternates = $removed_keywords{$state->{'spec_version'}}{$keyword})
515 0 238 if @list > 2
516 164 74 if @list > 1
526 0 27852 unless defined wantarray
534 3 27849 if $state->{'depth'}++ > $self->max_traversal_depth
537 768 27081 if $schema_type eq "boolean"
540 0 27081 if $schema_type ne "object"
542 260 26821 unless keys %$schema
550 1 26820 if grep((substr($schema_location, 0, length $_) eq $_), keys %{$state->{'seen'}{$state->{'data_path'}}{$canonical_uri}})
579 1277470 55150 unless exists $schema->{$keyword}
582 11 51592 if $keyword ne "\$ref" and exists $schema->{'$ref'} and $state->{'spec_version'} eq "draft7"
587 43117 12022 if ($sub)
590 10578 32472 unless (&$sub($vocabulary, $data, $schema, $state))
592 0 10578 if $error_count == @{$state->{'errors'}}
595 4122 6456 if $state->{'short_circuit'}
600 19 44475 if (my $callback = $state->{'callbacks'}{$keyword})
603 2 17 unless (&$callback($data, $schema, $state))
605 0 2 if $error_count == @{$state->{'errors'}}
608 1 1 if $state->{'short_circuit'}
617 2 26751 if ($state->{'strict'} and keys %unknown_keywords)
618 2 0 keys %unknown_keywords > 1 ? :
622 824 15517 if ($valid and $state->{'collect_annotations'} and not $state->{'spec_version'} =~ qr/^draft(7|2019-09)$/u)
628 16341 10410 if $valid
721 0 8 if grep(($_->[1] eq $classname), $self->_get_vocabulary_values)
767 13792 5 if $metaschema_info
780 3 6 $e->keyword eq '$schema' ? :
8 1 length $absolute_location ? :
790 3 2 if @{$state->{'errors'}}
829 3683 78 if $resource
831 72 6 if (my $local_filename = $self->CACHED_METASCHEMAS->{$uri})
837 0 72 if $document->has_errors
869 92 4490 unless XXX
872 3760 822 if (not length $fragment or $fragment =~ m[^/]u) { }
874 3754 6 if (my $resource = $self->_get_or_load_resource($base))
876 6 3748 unless defined $subschema
879 892 3064 unless not length $_->[1]{'path'}
887 2323 1425 unless length $canonical_uri->fragment
898 720 102 if (my $resource = $self->_get_resource($uri))
900 0 720 unless defined $subschema