Branch Coverage

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


line true false branch
127 0 13548 if @_ < 2
131 0 28 $_[0]->$JSON::Schema::Modern::_isa('Mojo::URL') ? :
13520 28 !XXX ? :
134 1 13547 if defined $uri->fragment
136 2 13545 unless (@_)
138 1 1 unless $schema_info and defined wantarray
143 13531 0 $uri ? :
14 13531 $_[0]->$JSON::Schema::Modern::_isa('JSON::Schema::Modern::Document') ? :
150 117 13428 if ($document->has_errors)
160 13423 5 unless (grep((&refaddr($_->{'document'}) == &refaddr($document)), $self->_canonical_resources))
164 9417 4006 if (my $existing_doc = &first(sub {
178 358 13064 if ("$uri")
194 0 3 unless defined wantarray
291 0 13197 unless defined wantarray
380 0 13080 if $valid xor not @{$state->{'errors'}}
389 18 7280 $config_override->{'collect_annotations'} // $self->collect_annotations ? :
7298 5782 $valid ? :
394 0 3 unless defined wantarray
397 2 1 XXX && $schema->{'$schema'} ? :
404 2 8 unless $schema_info
405 6 2 XXX ? :
406 5 3 wantarray ? :
452 0 32147 if $state->{'depth'}++ > $self->max_traversal_depth
455 6782 25365 if $schema_type eq "boolean"
457 10 25355 if $schema_type ne "object"
459 439 24916 unless keys %$schema
475 1303932 44850 unless exists $schema->{$keyword}
478 26 42355 if $keyword ne "\$ref" and exists $schema->{'$ref'} and $state->{'spec_version'} eq "draft7"
483 179 44645 unless (&$sub($vocabulary, $schema, $state))
484 0 179 unless @{$state->{'errors'}}
489 4 44641 if (my $callback = $state->{'callbacks'}{$keyword})
490 0 4 unless (&$callback($schema, $state))
491 0 0 unless @{$state->{'errors'}}
501 1 24915 if ($self->strict and keys %unknown_keywords)
502 1 0 keys %unknown_keywords > 1 ? :
508 92883 238 unless exists $schema->{$keyword}
511 238 0 if (my $alternates = $removed_keywords{$state->{'spec_version'}}{$keyword})
513 0 238 if @list > 2
514 164 74 if @list > 1
524 0 27540 unless defined wantarray
532 3 27537 if $state->{'depth'}++ > $self->max_traversal_depth
535 768 26769 if $schema_type eq "boolean"
538 0 26769 if $schema_type ne "object"
540 248 26521 unless keys %$schema
548 1 26520 if grep((substr($schema_location, 0, length $_) eq $_), keys %{$state->{'seen'}{$state->{'data_path'}}{$canonical_uri}})
577 1264098 54650 unless exists $schema->{$keyword}
580 11 51168 if $keyword ne "\$ref" and exists $schema->{'$ref'} and $state->{'spec_version'} eq "draft7"
585 42743 11896 if ($sub)
588 10438 32238 unless (&$sub($vocabulary, $data, $schema, $state))
590 0 10438 if $error_count == @{$state->{'errors'}}
593 4058 6380 if $state->{'short_circuit'}
598 19 44115 if (my $callback = $state->{'callbacks'}{$keyword})
601 2 17 unless (&$callback($data, $schema, $state))
603 0 2 if $error_count == @{$state->{'errors'}}
606 1 1 if $state->{'short_circuit'}
615 2 26451 if ($state->{'strict'} and keys %unknown_keywords)
616 2 0 keys %unknown_keywords > 1 ? :
620 814 15367 if ($valid and $state->{'collect_annotations'} and not $state->{'spec_version'} =~ qr/^draft(7|2019-09)$/u)
626 16181 10270 if $valid
719 0 8 if grep(($_->[1] eq $classname), $self->_get_vocabulary_values)
765 13640 5 if $metaschema_info
778 3 6 $e->keyword eq '$schema' ? :
8 1 length $absolute_location ? :
788 3 2 if @{$state->{'errors'}}
827 3623 78 if $resource
829 72 6 if (my $local_filename = $self->CACHED_METASCHEMAS->{$uri})
835 0 72 if $document->has_errors
867 92 4382 unless XXX
870 3700 774 if (not length $fragment or $fragment =~ m[^/]u) { }
872 3694 6 if (my $resource = $self->_get_or_load_resource($base))
874 6 3688 unless defined $subschema
877 870 3012 unless not length $_->[1]{'path'}
885 2315 1373 unless length $canonical_uri->fragment
896 684 90 if (my $resource = $self->_get_resource($uri))
898 0 684 unless defined $subschema